Article View: pl.comp.lang.python
Article #27878Re: pobieranie pliku + autoryzacja
From: Trimar
Date: Thu, 13 Jan 2011 08:34
Date: Thu, 13 Jan 2011 08:34
15 lines
1638 bytes
1638 bytes
W dniu 2011-01-13 00:18, Desper0 pisze:
> -------------------8<--------------------------------------------------------
> Oraz komunikat błędu:
> HTTP Error 401: Unauthorized
> Traceback (most recent call last):
> File "D:\workspace\parsXml\src\parser.py", line 40, in<module>
> the_page = response.read()
> NameError: name 'response' is not defined
Witam
Może zobacz tak
authentication_handler=urllib.HTTPBasicAuthHandler(urllib.HTTPPasswordMgrWithDefaultRealm())
authentication_handler.add_password(None,url2,'user','password')
auth_opener = urllib.build_opener(authentication_handler)
urllib.install_opener(auth_opener)
req = urllib.Request(url2)
Technical Details
Message-ID:
<igmdfu$ptd$1@news.onet.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!.POSTED!not-for-mailReferences:
<e62ff482-6c5b-4eef-b0d4-fcccb68a182e@j29g2000yqm.googlegroups.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!.POSTED!not-for-mail From: Trimar <trimar12@poczta.onet.pl> Newsgroups: pl.comp.lang.python Subject: Re: pobieranie pliku + autoryzacja Date: Thu, 13 Jan 2011 09:34:53 +0100 Organization: http://onet.pl Lines: 15 Message-ID: <igmdfu$ptd$1@news.onet.pl> References: <e62ff482-6c5b-4eef-b0d4-fcccb68a182e@j29g2000yqm.googlegroups.com> NNTP-Posting-Host: stallman.rootnode.net Mime-Version: 1.0 X-Trace: news.onet.pl 1294907710 26541 89.248.165.10 (13 Jan 2011 08:35:10 GMT) X-Complaints-To: niusy@onet.pl NNTP-Posting-Date: Thu, 13 Jan 2011 08:35:10 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 In-Reply-To: <e62ff482-6c5b-4eef-b0d4-fcccb68a182e@j29g2000yqm.googlegroups.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit