Unicode fix for py3
authorIb Lundgren <ib.lundgren@gmail.com>
Tue, 15 May 2012 15:37:15 +0000 (17:37 +0200)
committerIb Lundgren <ib.lundgren@gmail.com>
Tue, 15 May 2012 15:37:15 +0000 (17:37 +0200)
requests/auth.py

index c9a1a02f4296396cd08ed81c8d2c4ad2d0439bdc..e636b72402ef8749d96ccf8d224c762b65b8582c 100644 (file)
@@ -98,11 +98,11 @@ class OAuth1(AuthBase):
             # >>> d['a'] = 'foo'
             # >>> d
             # { u'a' : 'foo' }
-            if u'Authorization' in r.headers:
-                auth_header = r.headers[u'Authorization'].encode('utf-8')
-                del r.headers[u'Authorization']
+            u_header = unicode('Authorization')
+            if u_header in r.headers:               
+                auth_header = r.headers[u_header].encode('utf-8')
+                del r.headers[u_header]
                 r.headers['Authorization'] = auth_header
-                print r.headers
 
             return r