import requests, json
session = requests.session()
session.get('https://httpbin.org/cookies/set/my-cookie/my-value')
print(session.get('https://httpbin.org/cookies').json())
with open('cookies.json', 'w') as f:
json.dump(requests.utils.dict_from_cookiejar(session.cookies), f)
session = requests.session()
print(session.get('https://httpbin.org/cookies').json())
with open('cookies.json') as f:
session.cookies.update(json.load(f))
print(session.get('https://httpbin.org/cookies').json())