mullender / python-ntlm

Automatically exported from code.google.com/p/python-ntlm
90 stars 42 forks source link

response objects have no code, msg properties #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. get a response using NTLM library
2. print response.code
3. print response.msg

What is the expected output? What do you see instead?

expected the response message, i.e. 'OK'
expected the response code, i.e. 200

What version of the product are you using? On what operating system?

revision 77. Python 2.4. Linux RHEL 4.6

Please provide any additional information below.

Original issue reported on code.google.com by mischko....@gmail.com on 17 Dec 2009 at 9:43

GoogleCodeExporter commented 9 years ago
Sorry. What I get is "AttributeError: addinfourl instance has no attribute 
'code'"
and "AttributeError: addinfourl instance has no attribute 'msg'"

Original comment by mischko....@gmail.com on 17 Dec 2009 at 9:44

GoogleCodeExporter commented 9 years ago
From copying a bit of the urllib2 source code:

Index: python26/ntlm/HTTPNtlmAuthHandler.py
===================================================================
--- python26/ntlm/HTTPNtlmAuthHandler.py        (revision 77)
+++ python26/ntlm/HTTPNtlmAuthHandler.py        (working copy)
@@ -81,7 +81,9 @@
                 def notimplemented():
                     raise NotImplementedError
                 response.readline = notimplemented
-                return addinfourl(response, response.msg, req.get_full_url())
+                infourl = addinfourl(response, response.msg, 
req.get_full_url())
+                infourl.code = response.status
+                infourl.msg = response.reason
             except socket.error, err:
                 raise urllib2.URLError(err)
         else:

Original comment by dho...@gmail.com on 12 Jan 2011 at 10:16

GoogleCodeExporter commented 9 years ago
Obviously, in the patch I forgot to return infourl

Original comment by dho...@gmail.com on 13 Jan 2011 at 3:09

GoogleCodeExporter commented 9 years ago
Please test to make sure this feature is working properly.

Original comment by dho...@gmail.com on 13 Jan 2011 at 5:59