dragon dragon - 10 months ago 40
Python Question

Enter page that you have to be logged in

I need To send get request To page that I have to login first


requests module

I tried to first send post request and make login with my information

Then using cookies which is [phpsessionid] & send it with the get request

cookie = {'PHPSESSID': 'm7v485i9g1rfm3tqcn0aa531rvjf5d26'}

x = requests.get('https://www.example.com/',cookies=cookie)

but it doesn't work !

And idea on how to open the page ?


Instead of trying to hijack a session, login using requests with something like:

session = requests.session()
session.post(loginUrl, data={'username':username, 'password':password, ... (anything else the login page posts)}
response = session.get(anyInternalPage)