Python - login to website using requests -


i have admit complitely clueless this: need login site https://segreteriaonline.unisi.it/home.do , perform actions. problem cannot find form use in source of webpage, , have never tried login website via python. simple code wrote.

import requests  url_from    = 'https://segreteriaonline.unisi.it/home.do' url_in      = 'https://segreteriaonline.unisi.it/auth/logon.do'  data = {'form':'1', 'username':'myuser', 'password':'mypass'}  s = requests.session() s.get(url_from) r = s.post(url_in, data)  print r 

obviously, is:

<response [401]> 

any suggestions? in advance.

you need use requests authentication header.

please check here:

from requests.auth import httpbasicauth requests.get('https://api.github.com/user', auth=httpbasicauth('user', 'pass')) <response [200]> 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -