I am writing a script to enter some web page. I use the request and request.session module for this. On the first request with the parameters of the login server, the session identifier is indicated. How to set this session identifier for further access to the same page.
url = "some url of login page"
payload = {'username': 'p05989', 'password': '123456'}
with requests.session() as s:
s.post(url1, data=payload)
sessionid = s.cookies.get('SESSIONID')
print(sessionid)
r = requests.get(url,data=payload)
print(r.text)
in the above code, serverid replies sessionid to the first request. How to use this sessionid for the second request?
source
share