Author mcepl
Recipients mcepl
Date 2013-11-25.12:58:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1385384336.86.0.506975942871.issue19494@psf.upfronthosting.co.za>
In-reply-to
Content
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 test_create_1.py
DEBUG:<module>:gh_url = https://api.github.com/repos/mcepl/odt2rst/issues/
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 "test_create_1.py", line 80, in <module>
    handler = opener.open(req, json.dumps(create_data).encode('utf8'))
  File "/usr/lib64/python3.3/urllib/request.py", line 475, in open
    response = meth(req, response)
  File "/usr/lib64/python3.3/urllib/request.py", line 587, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib64/python3.3/urllib/request.py", line 513, in error
    return self._call_chain(*args)
  File "/usr/lib64/python3.3/urllib/request.py", line 447, in _call_chain
    result = func(*args)
  File "/usr/lib64/python3.3/urllib/request.py", 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?
History
Date User Action Args
2013-11-25 12:58:56mceplsetrecipients: + mcepl
2013-11-25 12:58:56mceplsetmessageid: <1385384336.86.0.506975942871.issue19494@psf.upfronthosting.co.za>
2013-11-25 12:58:56mcepllinkissue19494 messages
2013-11-25 12:58:55mceplcreate