Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(841)

Side by Side Diff: third_party/logilab/common/urllib2ext.py

Issue 739393004: Revert "Revert "pylint: upgrade to 1.3.1"" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 import logging 1 import logging
2 import urllib2 2 import urllib2
3 3
4 import kerberos as krb 4 import kerberos as krb
5 5
6 class GssapiAuthError(Exception): 6 class GssapiAuthError(Exception):
7 """raised on error during authentication process""" 7 """raised on error during authentication process"""
8 8
9 import re 9 import re
10 RGX = re.compile('(?:.*,)*\s*Negotiate\s*([^,]*),?', re.I) 10 RGX = re.compile('(?:.*,)*\s*Negotiate\s*([^,]*),?', re.I)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 server_response = self.parent.open(req) 55 server_response = self.parent.open(req)
56 negotiate = get_negociate_value(server_response.info()) 56 negotiate = get_negociate_value(server_response.info())
57 if negotiate is None: 57 if negotiate is None:
58 logging.warning('HTTPGssapiAuthHandler: failed to authenticate s erver') 58 logging.warning('HTTPGssapiAuthHandler: failed to authenticate s erver')
59 else: 59 else:
60 logging.debug('HTTPGssapiAuthHandler negotiate 2: %s' % negotiat e) 60 logging.debug('HTTPGssapiAuthHandler negotiate 2: %s' % negotiat e)
61 result = krb.authGSSClientStep(self._context, negotiate) 61 result = krb.authGSSClientStep(self._context, negotiate)
62 if result < 1: 62 if result < 1:
63 raise GssapiAuthError("HTTPGssapiAuthHandler: step 2 failed with %d" % result) 63 raise GssapiAuthError("HTTPGssapiAuthHandler: step 2 failed with %d" % result)
64 return server_response 64 return server_response
65 except GssapiAuthError, exc: 65 except GssapiAuthError as exc:
66 logging.error(repr(exc)) 66 logging.error(repr(exc))
67 finally: 67 finally:
68 self.clean_context() 68 self.clean_context()
69 self._reset() 69 self._reset()
70 70
71 if __name__ == '__main__': 71 if __name__ == '__main__':
72 import sys 72 import sys
73 # debug 73 # debug
74 import httplib 74 import httplib
75 httplib.HTTPConnection.debuglevel = 1 75 httplib.HTTPConnection.debuglevel = 1
76 httplib.HTTPSConnection.debuglevel = 1 76 httplib.HTTPSConnection.debuglevel = 1
77 # debug 77 # debug
78 import logging 78 import logging
79 logging.basicConfig(level=logging.DEBUG) 79 logging.basicConfig(level=logging.DEBUG)
80 # handle cookies 80 # handle cookies
81 import cookielib 81 import cookielib
82 cj = cookielib.CookieJar() 82 cj = cookielib.CookieJar()
83 ch = urllib2.HTTPCookieProcessor(cj) 83 ch = urllib2.HTTPCookieProcessor(cj)
84 # test with url sys.argv[1] 84 # test with url sys.argv[1]
85 h = HTTPGssapiAuthHandler() 85 h = HTTPGssapiAuthHandler()
86 response = urllib2.build_opener(h, ch).open(sys.argv[1]) 86 response = urllib2.build_opener(h, ch).open(sys.argv[1])
87 print '\nresponse: %s\n--------------\n' % response.code, response.info() 87 print '\nresponse: %s\n--------------\n' % response.code, response.info()
OLDNEW
« no previous file with comments | « third_party/logilab/common/ureports/text_writer.py ('k') | third_party/logilab/common/visitor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698