This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mcepl
Recipients mcepl
Date 2013-11-25.12:58:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I am trying to work on fixing issue 19494 (HTTPBasicAuthHandler doesn't work with Github and other websites which require prior Authorization header in the first request).

I have created this testing script calling GitHub v3 API using new “authentication handlers” (they are subclasses of HTTPSHandler, not HTTPBasicAuthHandler) and hoped that when I manage to make this script working, I could rewrite it into patch against cpython code.

However, when I run this script I get this error (using python3-3.3.2-8.el7.x86_64)

matej@wycliff: $ python3
DEBUG:<module>:gh_url =
DEBUG:<module>:req = <urllib.request.Request object at 0x7fee384a9fd0>
DEBUG:<module>:req.type = https
DEBUG:http_request:type = https
Traceback (most recent call last):
  File "", line 80, in <module>
    handler =, json.dumps(create_data).encode('utf8'))
  File "/usr/lib64/python3.3/urllib/", line 475, in open
    response = meth(req, response)
  File "/usr/lib64/python3.3/urllib/", line 587, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib64/python3.3/urllib/", line 513, in error
    return self._call_chain(*args)
  File "/usr/lib64/python3.3/urllib/", line 447, in _call_chain
    result = func(*args)
  File "/usr/lib64/python3.3/urllib/", line 595, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 401: Unauthorized
matej@wycliff: $

Could anybody suggest what I am doing wrong? I seem to have problem of working in between two superclasses (HTTPHandler and AbstractBasicAuthHandler). I guess I need to somehow include into opener original HTTPBasicAuthHandler (for error handlers). Any ideas how to do it?
Date User Action Args
2013-11-25 12:58:56mceplsetrecipients: + mcepl
2013-11-25 12:58:56mceplsetmessageid: <>
2013-11-25 12:58:56mcepllinkissue19494 messages
2013-11-25 12:58:55mceplcreate