When studying programming, I ran into a problem, I need to fill out and send the form by type:

<form method=“GET(или POST)”> Введите логин: <input type=“text” /> Введите пароль: <input type=“password” /> <input type=“submit” value=“submit”> </form> 

And I know that requests have authorization methods, but I do not know which one to apply. If it is possible, I ask in the answer to show in more detail what should be written in the arguments, otherwise it is not very clear from the documentation.

1 answer 1

Example (taken from here) :

 import requests # Fill in your details here to be posted to the login form. payload = { 'inUserName': 'username', 'inUserPass': 'password' } # Use 'with' to ensure the session context is closed after use. with requests.Session() as s: p = s.post(LOGIN_URL, data=payload) 
  • 2
    (hmm, but there is no need for sessions on the first page of the requests requests) - andreymal