How to use the library requests (in python) after a request
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
bot = requests.session
You can pickle the cookies object directly:
cookies = pickle.dumps(session.cookies)
The dict representation misses a lot of informations: expiration, domain, path...
It depends on the usage you intend to do with the cookies, but if you don't have informations about the expiration, for example, you should implement the logic to track expiration by hand.
Pickling the library returned object lets you easily reconstruct the state, then you can relay on the library implementation.
Obviously, this way, the consumer of the pickled object needs to use the same library