Staying Logged In W/ Python Requests
So I am trying to log into and navigate to a page using python and requests. I'm pretty sure I am getting logged in, but once I try to navigate to a page the HTML I print from that
Solution 1:
Here's an example of logging in, getting the resultant cookies, then using them to make another request:
login_request = requests.post(ROUTE_AUTHENTICATE,
data=LOGIN_CREDS,
headers={"Content-Type": "application/json"})
self.assertEqual(login_request.status_code, 200)
self.cookies = login_request.cookies
...
thing_request = requests.get(url, cookies=self.cookies)
self.assertTrue(thing_request.status_code, 200)
things = json.loads(things.text)
Post a Comment for "Staying Logged In W/ Python Requests"