python-requests save cookies code example
Example: python save cookies
import requests, pickle
session = requests.session()
# (Make some calls)
# Save the cookies to file:
with open('somefile', 'wb') as f:
pickle.dump(session.cookies, f)
# __________________________________
# Get the cookies from file:
session = requests.session() # or an existing session
with open('somefile', 'rb') as f:
session.cookies.update(pickle.load(f))