Python Forum
Save Cookie header value in var
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Save Cookie header value in var
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to save to multiple locations during save cubangt 1 559 Oct-23-2023, 10:16 PM
Last Post: deanhystad
  Requests Session Overwriting and cookie jar muzikman 0 1,299 Dec-13-2021, 02:22 PM
Last Post: muzikman
  Cookie and Session JohnnyCoffee 6 3,113 Apr-14-2020, 02:04 PM
Last Post: JohnnyCoffee
  Extract Httponly, Secure, domain and path from a cookie randeniyamohan 0 1,677 Jan-26-2020, 04:59 PM
Last Post: randeniyamohan

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020