Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests, lxml.html
- import getpass
- s = requests.session()
- login = s.get('https://www.tianyancha.com/login')
- login_html = lxml.html.fromstring(login.text)
- hidden_inputs = login_html.xpath(r'//input[@class="loginState"]')
- form = {x.attrib["value"] for x in hidden_inputs}
- print form
- username =input("Please insert your username:")
- password = getpass.getpass("Please type in your password")
- form['email'] = '{!r}'.format(username)
- form['password'] = '{!r}'.format(password)
- response = s.post('https://www.tianyancha.com/login', data=form)
Add Comment
Please, Sign In to add comment