A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/096465.html below:

urllib, python 1.52, basic authentication

urllib, python 1.52, basic authenticationSteve Purcell stephen_purcell at yahoo.com
Thu Apr 19 02:29:38 EDT 2001
Ari Davidow wrote:
> I am trying to request a page that is being protected by basic authentication.
> 
> import httplib, urllib,binascii
> cookie = binascii.b2a_base64("user:password")
> h = httplib.HTTP("www.site.com")
> h.putrequest("GET", "/admin/flushgo.html?ok=ok" "HTTP/1.0\r\n")


I think you can (and should) omit that HTTP/1.0 specifier and the line ending.

       h.putrequest("GET", "/admin/flushgo.html?ok=ok")


> h.putheader("Proxy-authorization", "Basic %s" % cookie)


And here, according to the source of urllib2.py, this should be changed to:

       h.putheader("Authorization", "Basic %s" % cookie)

Good luck,

-Steve


-- 
Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Any opinions expressed herein are my own and not necessarily those of Yahoo


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4