So, I asked this question before here . However, something on the Flurry website has changed and the answer no longer works.
from bs4 import BeautifulSoup import requests loginurl = "https://dev.flurry.com/secure/loginAction.do" csvurl = "https://dev.flurry.com/eventdata/.../..." #URL to get CSV 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) getcsv = session.get(csvurl)
This code worked fine for the last month, and then it stopped working last week. For life, I cannot understand what has changed on the website. Name and token identifiers look correct, username and password are not changed. Im at a loss.
If I log in manually, I can download csv just fine using csvurl .
login.histroy shows:
[<Response [302]>, <Response [302]>, <Response [302]>, <Response [302]>, <Response [303]>]
If anyone can take a look and find out where I'm wrong, I would really appreciate it.
Thanks.
UPDATE
So, from the new login address, I see that the message should be in this format:
{"data":{"type":"session","id":"bd7d8dc1-4a86-4aed-a618-0b2765b03fb7","attributes":{"scopes":"","email":"myemail","password":"mypass","remember":"false"}}}
What I cannot understand is how they generated the identifier. Can anyone take a look?