Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(39)

Side by Side Diff: python3/httplib2/__init__.py

Issue 6506074: Making httplib2.Http instances pickleable. (Closed)
Patch Set: Adding in missing args and kwargs to ResponseDict. Created 1 year, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « python2/httplib2test.py ('k') | python3/httplib2test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 """ 2 """
3 httplib2 3 httplib2
4 4
5 A caching http interface that supports ETags and gzip 5 A caching http interface that supports ETags and gzip
6 to conserve bandwidth. 6 to conserve bandwidth.
7 7
8 Requires Python 3.0 or later 8 Requires Python 3.0 or later
9 9
10 Changelog: 10 Changelog:
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 - caching 791 - caching
792 - ETags 792 - ETags
793 - compression, 793 - compression,
794 - HTTPS 794 - HTTPS
795 - Basic 795 - Basic
796 - Digest 796 - Digest
797 - WSSE 797 - WSSE
798 798
799 and more. 799 and more.
800 """ 800 """
801 def __init__(self, cache=None, timeout=None, proxy_info=None, 801 def __init__(self, cache=None, timeout=None, proxy_info=None,
jcgregorio_google 2012/09/17 17:46:22 Looks like defaulting to proxyinfo from environmen
dhermes 2012/09/17 17:48:20 Joe, This never existed before. Can we add this i
802 ca_certs=None, disable_ssl_certificate_validation=False): 802 ca_certs=None, disable_ssl_certificate_validation=False):
803 """If 'cache' is a string then it is used as a directory name for 803 """If 'cache' is a string then it is used as a directory name for
804 a disk cache. Otherwise it must be an object that supports the 804 a disk cache. Otherwise it must be an object that supports the
805 same interface as FileCache. 805 same interface as FileCache.
806 806
807 All timeouts are in seconds. If None is passed for timeout 807 All timeouts are in seconds. If None is passed for timeout
808 then Python's default timeout for sockets will be used. See 808 then Python's default timeout for sockets will be used. See
809 for example the docs of socket.setdefaulttimeout(): 809 for example the docs of socket.setdefaulttimeout():
810 http://docs.python.org/library/socket.html#socket.setdefaulttimeout 810 http://docs.python.org/library/socket.html#socket.setdefaulttimeout
811 811
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 858
859 self.ignore_etag = False 859 self.ignore_etag = False
860 860
861 self.force_exception_to_status_code = False 861 self.force_exception_to_status_code = False
862 862
863 self.timeout = timeout 863 self.timeout = timeout
864 864
865 # Keep Authorization: headers on a redirect. 865 # Keep Authorization: headers on a redirect.
866 self.forward_authorization_headers = False 866 self.forward_authorization_headers = False
867 867
868 def __getstate__(self):
869 state_dict = copy.copy(self.__dict__)
870 # In case request is augmented by some foreign object such as
871 # credentials which handle auth
872 if 'request' in state_dict:
873 del state_dict['request']
874 if 'connections' in state_dict:
875 del state_dict['connections']
876 return state_dict
877
878 def __setstate__(self, state):
879 self.__dict__.update(state)
880 self.connections = {}
881
868 def _auth_from_challenge(self, host, request_uri, headers, response, content ): 882 def _auth_from_challenge(self, host, request_uri, headers, response, content ):
869 """A generator that creates Authorization objects 883 """A generator that creates Authorization objects
870 that can be applied to requests. 884 that can be applied to requests.
871 """ 885 """
872 challenges = _parse_www_authenticate(response, 'www-authenticate') 886 challenges = _parse_www_authenticate(response, 'www-authenticate')
873 for cred in self.credentials.iter(host): 887 for cred in self.credentials.iter(host):
874 for scheme in AUTH_SCHEME_ORDER: 888 for scheme in AUTH_SCHEME_ORDER:
875 if scheme in challenges: 889 if scheme in challenges:
876 yield AUTH_SCHEME_CLASSES[scheme](cred, host, request_uri, h eaders, response, content, self) 890 yield AUTH_SCHEME_CLASSES[scheme](cred, host, request_uri, h eaders, response, content, self)
877 891
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 for key, value in info.items(): 1285 for key, value in info.items():
1272 self[key.lower()] = value 1286 self[key.lower()] = value
1273 self.status = int(self.get('status', self.status)) 1287 self.status = int(self.get('status', self.status))
1274 1288
1275 1289
1276 def __getattr__(self, name): 1290 def __getattr__(self, name):
1277 if name == 'dict': 1291 if name == 'dict':
1278 return self 1292 return self
1279 else: 1293 else:
1280 raise AttributeError(name) 1294 raise AttributeError(name)
OLDNEW
« no previous file with comments | « python2/httplib2test.py ('k') | python3/httplib2test.py » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1278:e6ce13d99bf5