dimanche 7 novembre 2021

Im trying login a website with requests in python

I'm trying to login to my coingecko account, but it says the login is wrong even though my account information is correct. Here is my code: (I tried updating the header etc.but it doesnt work)

import time

import requests
import json

s = requests.session()
r = s.get("https://www.coingecko.com/accounts/csrf_meta.json")
token = r.json()["token"]
cookie2 = s.cookies.get_dict()
cookie2 = json.dumps(cookie2)
cookie2 = json.loads(cookie2)
cookie3 = cookie2["_session_id"]

cookie = {
    "_session_id":f"{cookie3}"
}
data = {
    "utf8": "✓",
    "authenticity_token": token,
    "user[email]": "my mail",
    "user[password]": "my passw",
}

r2 = s.post("https://www.coingecko.com/account/sign_in?locale=tr",json=data,cookies=cookie)
print(r2.text)
print(s.cookies.get_dict())  # its give me 5B%5B%22alert%22%2C%22Invalid+Email+or+password.%22%5D%5D cookie value but my pass and email is true 






Aucun commentaire:

Enregistrer un commentaire