Home > OS >  Unable to login to website with cookies (python3)
Unable to login to website with cookies (python3)

Time:07-25

I am trying to log in to a website that requires a username/password and 2f authentication. I prefer to log in with cookies or PHP session. So far, I found a python lib (pycookiecheat) that seems okay but can't make the login successful.

My code so far is as follows:

import requests
import pycookiecheat

url = 'https://some-website-with-login.com'
cookie = pycookiecheat.chrome_cookies(url, cookie_file='/Users/path-to/Chrome/Default/Cookies')
s = requests.Session()
cookies = pycookiecheat.chrome_cookies(url)
x = s.get(url, cookies = cookies)
print(x.text)

The x.text returns the username/password which means my authentication was not successful. Could you, please let me know if you got some experience with pycookiecheat?

Based on the documentation this should work but you know.....

Thank you.

CodePudding user response:

This is a short update to let you know that I have fixed the issue. Anyway, thank you.

CodePudding user response:

What was the cause of the issue?

  • Related