I want to crawl a site which uses authentication. After login there are some content that i want to get. I cannot seem to make it work to login with python because it uses authentication token, so i thought there might be a way to log in in browser and observ the request and response to get the cookie which can authenticate the python script to access contens that are hidden behind validation.
I have tried to login with python script but could not get it work.
with requests.Session() as s:
r = s.get(url, headers=header)
#r = s.post(url, data=login_data, headers=header)
print(r.content)
#s.get(url, data=login_data, headers=header)
login_data = {
'authenticity_token': '',
'user[id]': '',
'user[name]': '',
'user[pass]': '',
'commit': 'login'
}
Aucun commentaire:
Enregistrer un commentaire