I pay for access to website www.publicdata.com and I am trying to create a python program to help with my queries. Unfortunately, I keep getting a blank list of cookies while using the requests module. For security reasons I cannot share my credentials but the website has a demo link that can be used to see what I am talking about.
I have checked the cookies in the browser and they show up after I login but I can't seem to get them through requests.
Here is the publicdata api for login: http://www.publicdata.com/pdapidocs/pdlogindocs.php
Here is my code:
import requests
url = "https://login.publicdata.com/pdmain.php/Logon/checkAccess"
login_data = {'login_id': 'myuser', 'password': 'mypass'}
s = requests.Session()
r = s.post(url, data=login_data, allow_redirects=True)
r2 = s.get("http://demosrch.publicdata.com")
print(r.cookies.get_dict())
print(r2.cookies.get_dict())
print(r.headers)
print(r2.headers)
demo_url = "http://demosrch.publicdata.com"
I expect the cookies to be retrieved. In the demo url the cookie it sets is called JSESSIONID.