I been trying to get a cookie and post it to a url in later use in the program, but I cant seem to get the cookie parameters to work.
Right now I have
response = requests.get("url")
But how exactly do I retrive cookies from this url and post them to a new url (the same cookies). The tutorial in requests is somewhat vague on the topic and gives examples I cannot test. Hope someone can help with further examples.
This is python 2.7 btw.
You want to use a session:
s = requests.session()
response = s.get('url')
You use the session just like the requests
module (it has the same methods), but it'll retain cookies for you and send them along on future requests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With