Title: urllib HTTP authentication behavior with unrecognized auth method
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: jcea, orsenthil, python-dev, ubershmekel
Priority: normal Keywords: needs review

Created on 2011-04-07 19:32 by ubershmekel, last changed 2011-05-11 13:20 by orsenthil. This issue is now closed.

File name Uploaded Description Edit
urllib.auth.patch ubershmekel, 2011-04-07 19:32 more meaningful error in urllib.request review
urllib.auth2.patch ubershmekel, 2011-04-07 22:00 review
Messages (5)
msg133248 - (view) Author: Yuval Greenfield (ubershmekel) * Date: 2011-04-07 19:32
When trying to use urllib to open a page from a server with NTLM authentication python raises urllib.error.HTTPError: HTTP Error 401: Unauthorized

A python 3 code example:

This was a bit confusing for me as I had to debug urllib to figure out python doesn't support NTLM. I'd expect python to tell me the authentication method isn't supported in such cases.

I didn't add a test for the attached patch as it doesn't seem test-worthy.
msg133263 - (view) Author: Yuval Greenfield (ubershmekel) * Date: 2011-04-07 22:00
I noticed it's not only that python doesn't support NTLM, it's that I used Basic Auth which isn't NTLM. So I modified the patch to pertain to basic auth and digest as well.
msg133288 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2011-04-08 03:19
The patch seems ok. I think this should be applied to 3.2 and 3.3. Not sure about 3.1.
msg133289 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2011-04-08 03:25
With the patch there is a new exception with specific msg being raised in certain cases, so this may only pertain to 3.3
msg135774 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-05-11 13:18
New changeset 6072db001b51 by Senthil Kumaran in branch 'default':
Fix closes Issue #11799: urllib.request Authentication Handlers will raise a
Date User Action Args
2011-05-11 13:20:59orsenthilsetstatus: open -> closed
resolution: fixed
stage: resolved
2011-05-11 13:18:13python-devsetnosy: + python-dev
messages: + msg135774
2011-04-08 03:25:26orsenthilsetversions: - Python 3.2
nosy: + orsenthil

messages: + msg133289

assignee: orsenthil
2011-04-08 03:19:54jceasetversions: + Python 3.2, Python 3.3, - Python 3.4
nosy: + jcea

messages: + msg133288

keywords: + needs review, - patch
2011-04-07 22:00:08ubershmekelsetfiles: + urllib.auth2.patch

messages: + msg133263
2011-04-07 19:32:49ubershmekelcreate