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

Side by Side Diff: third_party/requests/packages/urllib3/contrib/ntlmpool.py

Issue 25004007: Update 'requests' lib to v2.0. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/swarm_client
Patch Set: Created 7 years, 2 months 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 # urllib3/contrib/ntlmpool.py 1 # urllib3/contrib/ntlmpool.py
2 # Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt) 2 # Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
3 # 3 #
4 # This module is part of urllib3 and is released under 4 # This module is part of urllib3 and is released under
5 # the MIT License: http://www.opensource.org/licenses/mit-license.php 5 # the MIT License: http://www.opensource.org/licenses/mit-license.php
6 6
7 """ 7 """
8 NTLM authenticating pool, contributed by erikcederstran 8 NTLM authenticating pool, contributed by erikcederstran
9 9
10 Issue #10, see: http://code.google.com/p/urllib3/issues/detail?id=10 10 Issue #10, see: http://code.google.com/p/urllib3/issues/detail?id=10
(...skipping 15 matching lines...) Expand all
26 class NTLMConnectionPool(HTTPSConnectionPool): 26 class NTLMConnectionPool(HTTPSConnectionPool):
27 """ 27 """
28 Implements an NTLM authentication version of an urllib3 connection pool 28 Implements an NTLM authentication version of an urllib3 connection pool
29 """ 29 """
30 30
31 scheme = 'https' 31 scheme = 'https'
32 32
33 def __init__(self, user, pw, authurl, *args, **kwargs): 33 def __init__(self, user, pw, authurl, *args, **kwargs):
34 """ 34 """
35 authurl is a random URL on the server that is protected by NTLM. 35 authurl is a random URL on the server that is protected by NTLM.
36 user is the Windows user, probably in the DOMAIN\username format. 36 user is the Windows user, probably in the DOMAIN\\username format.
37 pw is the password for the user. 37 pw is the password for the user.
38 """ 38 """
39 super(NTLMConnectionPool, self).__init__(*args, **kwargs) 39 super(NTLMConnectionPool, self).__init__(*args, **kwargs)
40 self.authurl = authurl 40 self.authurl = authurl
41 self.rawuser = user 41 self.rawuser = user
42 user_parts = user.split('\\', 1) 42 user_parts = user.split('\\', 1)
43 self.domain = user_parts[0].upper() 43 self.domain = user_parts[0].upper()
44 self.user = user_parts[1] 44 self.user = user_parts[1]
45 self.pw = pw 45 self.pw = pw
46 46
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 def urlopen(self, method, url, body=None, headers=None, retries=3, 112 def urlopen(self, method, url, body=None, headers=None, retries=3,
113 redirect=True, assert_same_host=True): 113 redirect=True, assert_same_host=True):
114 if headers is None: 114 if headers is None:
115 headers = {} 115 headers = {}
116 headers['Connection'] = 'Keep-Alive' 116 headers['Connection'] = 'Keep-Alive'
117 return super(NTLMConnectionPool, self).urlopen(method, url, body, 117 return super(NTLMConnectionPool, self).urlopen(method, url, body,
118 headers, retries, 118 headers, retries,
119 redirect, 119 redirect,
120 assert_same_host) 120 assert_same_host)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698