How To Submit GET Request using urllib-3 in python

Viewed 15

I'm trying to submit a get request using the following code in AWS Lambda.

hed = {'Authorization': f"bearer {token}"}
URL = "https://integrate.elluciancloud.com/api/academic-periods"
r = http.request('GET', URL, headers=hed)
print(r.data)

The Token which I'm passing is : iLCJ0b2ciOlsiRVhDSEFOR0VfREV.TSUdORVJfRU5BQkxFRCIsIlBBQ0tBR0VTX0ZFQVRVUkVTX0VOQUJMRUQiXSwicm9sZXMiOlsiYWZlZWYyMDQtZTM3MS00MTlhLWE4OTAtOTNlNjYyMWE0MjM4Il0sInRlbmFudCI6eyJpZCI6IjcyMjJhZmEwLWYzNGYtNDRhNy1hZWVmLTEzZDE5NWJkNTQ4YSIsImFjY291bnRJZCI6IkludGVybmFsRWxsdWNpYW5CYW5uZXJNb2Rlcm5pemF

But I'm the following error message in r.data

b'{"errors":[{"code":"General.error","description":"Application error","message":"java.lang.IllegalArgumentException"}]}'

I tried to encode the token (token = token.encode('ascii', 'ignore')) but it's not working

0 Answers
Related