use python requests library to simulate login, the form data is duplicated, how to submit data?
import requests
from bs4 import BeautifulSoup
url = "http://xxxxxxxxxxx/login_slogin.html"
username = input(":")
password = input(":")
headers = {
"user-agent": "Mozilla / 5.0(Windows NT 10.0; Win64; x64; rv: 61.0) Gecko / 20100101 Firefox / 61.0",
"Upgrade-Insecure-Requests":"1"
}
httpSession = requests.Session()
r = httpSession.get(url, headers = headers)
html = httpSession.get(url, headers=headers).text
soup = BeautifulSoup(html, "html.parser")
data = {
"csrftoken":soup.select("-sharpcsrftoken")[0].get("value"),
"yhm":username,
"mm":password,
}
httpSession.post(url, data=data, headers=headers)
resp = httpSession.get(url, headers=headers)
print(resp.text)
this is the form picture:
:
could you tell me how to submit such form data?