jeudi 30 juin 2016

Not able to to login using request library in Python


I am trying to open this website, and access the dashboard's information using requests library in python. This is kind of webscraping but the issue is I am not able to login. I tried bunch of different methods to post my login credentials but nothing is working so far.

Website - https://www.handy.com/login

Login HTML - <input autofocus="autofocus" class="string email required" id="user_session_email" name="user_session[email]" required="required" size="50" type="email">

Password HTML - <input class="password required" id="user_session_password" name="user_session[password]" required="required" size="50" type="password">

Code:

First I tried to use the name attribute of both the username and password

import requests
url = "https://www.handy.com/login"
payload = {"user_session[email]": "email or username", "user_session[password]": "password"}
r = requests.post(url, data=payload)
print r.status_code
print r.reason

Also tried with using id attribute of both username and password but the issue is same. Status code is 500 and reason is Internal Server Error. I know how to create persistent sessions but will appreciate if you can help me to login in the website.


Aucun commentaire:

Enregistrer un commentaire