-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
TLS Requests version
v1.1.3
Issue description
When unpickling a Response, NameError: name 'threading' is not defined gets thrown in RequestsCookieJar.__setstate__. I fixed this by importing threading in __setstate__:
def __setstate__(self, state):
"""Unlike a normal CookieJar, this class is pickleable."""
self.__dict__.update(state)
if "_cookies_lock" not in self.__dict__:
import threading
self._cookies_lock = threading.RLock()
Steps to reproduce / Code Sample
import tls_requests, pickle
resp = tls_requests.get('https://google.com')
resp.stream = None # remove so we can pickle resp
path = ...
with open(path, 'wb') as f:
pickle.dump(resp, f)
with open(path, 'rb') as f:
pickle.load(f) # raises: NameError: name 'threading' is not defined
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working