I have been looking everywhere for an answer however cannot seem to find one. I am using python requests to set a cookie from response headers which is displayed as a Set-Cookie.
For example if I print response.headers I get following output:
{'Date': 'Fri, 23 Aug 2019 14:56:36 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Content-Encoding': 'gzip', 'Set-Cookie': 'hash-code-8ee22a732=kdlk39393nsn3un; expires=Fri, 23-Aug-2019 18:56:36 GMT; Max-Age=14400; path=/, __le_cm=d971a61a7=; path=/; expires=Fri, 23-Aug-19 15:26:36 GMT; domain=.xokxk.com; HttpOnly', 'Vary': 'Accept-Encoding', 'Server': 'flare'}
So these are the response headers after a POST request, I would now like to only extract hash-code-8ee22a732=kdlk39393nsn3un
this cookie which is cookie name = cookie value respectively. I would like to then set this cookie in a separate request. What is the solution, as I can't seem to find a way to extract them from the long headers.
If your using the requests library it has sessions:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.