🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.python
Article #27881

Re: pobieranie pliku + autoryzacja

#27881
From: Desper0
Date: Thu, 13 Jan 2011 15:23
38 lines
2887 bytes
On 13 Sty, 15:59, Trimar <trima...@poczta.onet.pl> wrote:
> W dniu 2011-01-13 14:26, Desper0 pisze:
>
> >> Mo e zobacz tak
> >> authentication_handler=urllib.HTTPBasicAuthHandler(urllib.HTTPPasswordMgrWi­­thDefaultRealm())
> >>              authentication_handler.add_password(None,url2,'user','password')
> >>               auth_opener = urllib.build_opener(authentication_handler)
> >>               urllib.install_opener(auth_opener)
> >>              req = urllib.Request(url2)
>
> > Niestety,
> > efekt ten sam :401
>
> A możesz dodać coś takiego
>
> import httplib
> httplib.HTTPConnection.debuglevel = 1
>
> Zobaczymy co tam się majta po http i może da się coś poradzić
> Pozdrawiam
> Trimar

Odpowiedz z debugowania:
send: b'GET /Log/ProxyXML.aspx?type=xml HTTP/1.1\r\nAccept-Encoding:
identity\r\nHost: sss.com\r\nConnection: close\r\nUser-Agent: Python-
urllib/3.1\r\n\r\n'
reply: 'HTTP/1.1 302 Found\r\n'
header: Connection header: Date header: Server header: ETag header: X-
Powered-By header: X-AspNet-Version header: Location header: Set-
Cookie header: Cache-Control header: Pragma header: Expires header:
Content-Type header: Content-Length send: b'GET /Export_XML.aspx HTTP/
1.1\r\nAccept-Encoding: identity\r\nHost: TUTAJ_ADRES_IP\r
\nConnection: close\r\nUser-Agent: Python-urllib/3.1\r\n\r\n'
reply: 'HTTP/1.1 401 Unauthorized\r\n'
header: Connection header: Date header: Server header: ETag header: X-
Powered-By header: X-AspNet-Version header: WWW-Authenticate header:
Cache-Control header: Content-Type header: Content-Length HTTP Error
401: Unauthorized
Technical Details
Message-ID: <82bb0446-f5df-43d8-aa19-5df618f39610@v17g2000vbo.googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!v17g2000vbo.googlegroups.com!not-for-mail
References: <e62ff482-6c5b-4eef-b0d4-fcccb68a182e@j29g2000yqm.googlegroups.com> <igmdfu$ptd$1@news.onet.pl> <c7cca82f-ec09-481c-b1ca-715b98b11e73@u3g2000vbj.googlegroups.com> <ign40u$e8q$1@news.onet.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!v17g2000vbo.googlegroups.com!not-for-mail
From: Desper0 <ansic.soft@gmail.com>
Newsgroups: pl.comp.lang.python
Subject: Re: pobieranie pliku + autoryzacja
Date: Thu, 13 Jan 2011 07:23:40 -0800 (PST)
Organization: http://groups.google.com
Lines: 41
Message-ID: <82bb0446-f5df-43d8-aa19-5df618f39610@v17g2000vbo.googlegroups.com>
References: <e62ff482-6c5b-4eef-b0d4-fcccb68a182e@j29g2000yqm.googlegroups.com> <igmdfu$ptd$1@news.onet.pl> <c7cca82f-ec09-481c-b1ca-715b98b11e73@u3g2000vbj.googlegroups.com> <ign40u$e8q$1@news.onet.pl>
NNTP-Posting-Host: 91.150.137.78
Mime-Version: 1.0
X-Trace: posting.google.com 1294932221 16185 127.0.0.1 (13 Jan 2011 15:23:41 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 13 Jan 2011 15:23:41 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: v17g2000vbo.googlegroups.com; posting-host=91.150.137.78; posting-account=dOGb0woAAABYgbo_KkreKbF4CXejzAEs
User-Agent: G2/1.0
X-HTTP-UserAgent: Opera/9.80 (Windows NT 6.1; U; pl) Presto/2.7.62 Version/11.00,gzip(gfe)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit