Answers for "python set cookies"

0

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))
Posted by: Guest on May-15-2021
0

python set cookies

http = httplib2.Http()
# get cookie_value here
headers = {'Cookie':cookie_value}
response, content = http.request("http://www.theURL.com", 'GET', headers=headers)
Posted by: Guest on October-21-2021

Python Answers by Framework

Browse Popular Code Answers by Language