How to retrieve/create a new ASP.NET_SessionId cookie from site so that I can scrape it?

74 Views Asked by At

I’m trying to scrape an iPhone app using python--I figured out how to use mitmproxy/fiddler to generate this python code that accesses the api:

url = 'https://mobile.co.circasports.com/MobileService/api/sports/GetLeagueGroups'
response = requests.post(url, cookies={'ASP.NET_SessionId': '0cstclgr5g0ocadnmixiazhm'})

It works when I use the ASP.NET_SessionId that I see in mitmproxy but the SessionId expires after a bit and then I get a Response601. Is there a way to retrieve/create a new ASP.NET_SessionId using python without needing my phone+mitmproxy every time to look it up?

There is another call that I see in mitmproxy that looks like it should be useful called SetSessionId but that requires the SessionID as a parameter so I'm still not sure how to retrieve it in the first place:

url = 'https://mobile.co.circasports.com/MobileService/api/player/SetSessionId'
response = requests.post(url, params={'sessionId': 0cstclgr5g0ocadnmixiazhm})

Any help would be greatly appreciated!

0

There are 0 best solutions below