I'm building flask application and trying to send get request to JSM cloud from it; however, I got this error message: "Client must be authenticated to access this resource.","status-code": 401. Here's my code:
jiraurl = request.args.get('jiraurl')
usrname = request.args.get('usrname')
pwd = request.args.get('pwd') #API_token
url = "https://" + jiraurl +"/rest/servicedeskapi/servicedesk"
auth = HTTPBasicAuth(usrname, pwd)
headers = {
"Accept": "application/json"
}
response = requests.request(
"GET",
url,
headers=headers,
auth=auth
)
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))