I am trying to read a csv attachment using python requests.get method with oAUTH token. Its working fine in postman but not from from my program. I am trying to use below code
import requests
def callF():
url = "https://jiraurl.com/secure/attachment/26433/Bulk_Repo_Archival_SMDH.csv"
token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IkpKRmRuSURYTngt"
jira_headers = {"Authorization":str(token)}
#print(jira_headers)
data = requests.get(url,headers= jira_headers,verify=False)
print(data.content)
if __name__ == '__main__':
callF()
I am getting below response:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body onload="document.forms[0].submit()">
<noscript>
<p>
<strong>Note:</strong> Since your browser does not support JavaScript,
you must press the Continue button once to proceed.
</p>
</noscript>
<form action="https://idag2.jpmorganchase.com/adfs/ls/" method="post">
<div>
<input type="hidden" name="RelayState" value="-ZIP8P-/secure/attachment/2226433/Bulk_Repo_Archival_SMDH.csv"/>
<input type="hidden" name="SAMLRequest" value="PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c2FtbDJwOkF1dGhuUmVxdWVzdCB4bWxuczpzYW1sMnA9InVybjpvYXNpczpuYW1lczp0Yz"/>
</div>
<noscript>
<div>
<input type="submit" value="Continue"/>
</div>
</noscript>
</form>
</body>
</html>
However in postman also it gave same response for me for sometime but later somehow it is giving proper csv file data. I tried checking in multiple places but no luck. FYI it was working fine when we used basic authentication but after shifting to oAUTH its not working. Please help.