Guest User

Untitled

a guest
Jan 31st, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import requests, lxml.html
  2. import getpass
  3. s = requests.session()
  4.  
  5. login = s.get('https://www.tianyancha.com/login')
  6. login_html = lxml.html.fromstring(login.text)
  7.  
  8. hidden_inputs = login_html.xpath(r'//input[@class="loginState"]')
  9. form = {x.attrib["value"] for x in hidden_inputs}
  10. print form
  11.  
  12. username =input("Please insert your username:")
  13. password = getpass.getpass("Please type in your password")
  14. form['email'] = '{!r}'.format(username)
  15. form['password'] = '{!r}'.format(password)
  16. response = s.post('https://www.tianyancha.com/login', data=form)
Add Comment
Please, Sign In to add comment