How to automate website login using python

Viewed 13

I am trying to automate website login with username and password using python . But if i entered the wrong username and password . I am still getting no error. Could you please help. Our purpose to login through website with username and password and update the value in the same website . Below is the line of code:

import requests
# Fill in your details here to be posted to the login form.
payload = {
    'inUserName': '""',
    'inUserPass': '""'
}

LOGIN_URL='""'

# Use 'with' to ensure the session context is closed after use.
with requests.Session() as s:
    p = s.post(LOGIN_URL, data=payload)
    # print the html returned or something more intelligent to see if it's a successful login page.
    print(p.text)
    print(p.content)
    print(p.headers)
0 Answers
Related