I\'m attempting to open a login page (GET), fetch the cookies provided by the webserver, then submit a username and password pair to log into the site (POST).
Look
There's an included class called a session which automatically handles this sort of thing for you. You can create an instance of it, and then call get
and set
right on that instance instead.
import requests
URL1 = 'login prompt page'
URL2 = 'login submission URL'
session = requests.Session()
r = session.get(URL1)
r2 = session.post(URL2, data="username and password data payload")