mercredi 4 novembre 2020

How to login in web page using python

I must login in this page (https://web.spaggiari.eu/home/app/default/login.php) but i don't understend were i do a mistake.


import requests
from bs4 import BeautifulSoup

URL =  'https://web.spaggiari.eu/home/app/default/login.php?index.php'
URL2 = 'https://web.spaggiari.eu/home/app/default/menu_webinfoschool_studenti.php?custcode='
headers = {
    'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36'}

payload  = {
    'custcode': '',
    'login': 'name',
    'password': 'pass_code',
    'pin': '',
}

with requests.session() as session:
    r_post = session.post(URL, data=payload)
    r = session.get(URL2)
    print(r.text)

the page form use php to comunicate with the server i tried differents way but i can't do the login, someone can help me?




Aucun commentaire:

Enregistrer un commentaire