Python Forum
Save Cookie header value in var - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Save Cookie header value in var (/thread-12438.html)



Save Cookie header value in var - DavidFernandez - Aug-24-2018

Hi,
I need to get the value of a cookie which is 'JSESSIONID_AV'
I should save the value of this cookie for re-use in the rest of my orders in my API
I would like to know how I can do everything while keeping the code below

from urllib2 import Request, urlopen import ssl, os if (not os.environ.get('PYTHONHTTPSVERIFY', '') and getattr(ssl, '_create_unverified_context', None)): ssl._create_default_https_context = ssl._create_unverified_context values = """ { "email": "********", "password": "********" } """ headers = { 'Content-Type': 'application/json' } request = Request('https://200.2.1.20:7443/api/2.0/login', data=values, headers=headers) response_body = urlopen(request).read() print response_body.headers
thank you


This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.