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

Unified Diff: python3/httplib2/__init__.py

Issue 6506074: Making httplib2.Http instances pickleable. (Closed)
Patch Set: Adding in missing args and kwargs to ResponseDict. Created 11 years, 6 months ago
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « python2/httplib2test.py ('k') | python3/httplib2test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: python3/httplib2/__init__.py
===================================================================
--- a/python3/httplib2/__init__.py
+++ b/python3/httplib2/__init__.py
@@ -865,6 +865,20 @@
# Keep Authorization: headers on a redirect.
self.forward_authorization_headers = False
+ def __getstate__(self):
+ state_dict = copy.copy(self.__dict__)
+ # In case request is augmented by some foreign object such as
+ # credentials which handle auth
+ if 'request' in state_dict:
+ del state_dict['request']
+ if 'connections' in state_dict:
+ del state_dict['connections']
+ return state_dict
+
+ def __setstate__(self, state):
+ self.__dict__.update(state)
+ self.connections = {}
+
def _auth_from_challenge(self, host, request_uri, headers, response, content):
"""A generator that creates Authorization objects
that can be applied to requests.
« 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 f62528b