Rattle using python3 .Session () requests

It seems really straightforward, but for some reason it doesn't connect to flurry correctly and I cannot clear the data.

loginurl = "https://dev.flurry.com/secure/loginPage.do" csvurl = "https://dev.flurry.com/eventdata" session = requests.Session() login = session.post(loginurl, data={'loginEmail': 'user', 'loginPassword': 'pass'}) data = session.get(csvurl) 

Every time I try to use this, I am redirected back to the login screen (loginurl) without receiving new data. Could anyone successfully connect to this attempt?

Any help would be greatly appreciated, thanks.

+1
source share
1 answer

There are two more form fields that will be filled in struts.token.name and the value from the tokens struts.token.name ie, you should also send to loginAction.do:

enter image description here

You can do the initial get and parse the values ​​using bs4, then send the data:

 from bs4 import BeautifulSoup import requests loginurl = "https://dev.flurry.com/secure/loginAction.do" csvurl = "https://dev.flurry.com/eventdata"# data = {'loginEmail': 'user', 'loginPassword': 'pass'} with requests.Session() as session: session.headers.update({ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36"}) soup = BeautifulSoup(session.get(loginurl).content) name = soup.select_one("input[name=struts.token.name]")["value"] data["struts.token.name"] = name data[name] = soup.select_one("input[name={}]".format(name))["value"] login = session.post(loginurl, data=data) 
+1
source

All Articles