We have an application which does not support basic authentication yet. So I wrote a python script which sends a post request to login and then another request to a web service url. When I make the second call, my server is asking me to login again.
How can I use the same session to make the second call? Is it really possible? Below is the script
import requests
r = requests.post("https://myhost.com/login", verify=False, data={'IDToken1': 'administrator', 'IDToken2': 'TestPassw0rd', 'goto': 'https://myhost.com/', 'gotoInactive': 'https://myhost.com/login/?goto=https%3A%2F%2Fmyhost.com&login=inactive&user=administrator', 'gotoOnFail': 'https://myhost.com/login/?goto=https%3A%2F%2Fmyhost.com&login=fail&user=administrator'})
print r.status_code
print r.headers
print r.content
softwarePackages = requests.post("https://myhost.com/context-root/rest/softwarePackage/list", verify=False, data={'offset': 1, 'limit': 10, 'sortBy': 'importDate', 'ascending': 'false', 'platform': 'null'})
print softwarePackages.status_code
print softwarePackages.headers
print softwarePackages.content