Fix Issue8123 - TypeError in urllib when trying to use HTTP authentication

This commit is contained in:
Senthil Kumaran 2010-08-01 17:53:37 +00:00
parent c881f1592f
commit de0eb249c6
2 changed files with 13 additions and 2 deletions

View file

@ -1591,13 +1591,13 @@ class URLopener:
if proxy_passwd:
import base64
proxy_auth = base64.b64encode(proxy_passwd).strip()
proxy_auth = base64.b64encode(proxy_passwd.encode()).strip()
else:
proxy_auth = None
if user_passwd:
import base64
auth = base64.b64encode(user_passwd).strip()
auth = base64.b64encode(user_passwd.encode()).strip()
else:
auth = None
http_conn = connection_factory(host)