AWS API Gateway Autherizer lambda is working with warning:
/var/runtime/botocore/vendored/requests/api.py:64: DeprecationWarning: You are using the post() function from 'botocore.vendored.requests'. This dependency was removed from Botocore and will be removed from Lambda after 2020/03/31. https://aws.amazon.com/blogs/developer/removing-the-vendored-version-of-requests-from-botocore/. Install the requests package, 'import requests' directly, and use the requests.post() function instead.
I know this can be solved by importing requests package, but I tried if I could solve it using urllib3(default package in boto3). Below is my code
data = {
'token': access_token,
'client_id': client_id,
'client_secret': client_secret,
'token_type_hint': 'access_token'
}
http = urllib3.PoolManager()
encoded_data = json.dumps(data).encode('utf-8')
introspection = http.request(method='POST',
url=INTROSPECTION_ENDPOINT,
body=encoded_data,
headers={'Content-Type': 'application/x-www-form-urlencoded'}
)
after running the code I am getting the following error: {"error_description":"token parameter is required for the introspection endpoint.","error":"invalid_request"}'
but the same is working using requests
data = {
'token': access_token,
'client_id': client_id,
'client_secret': client_secret,
'token_type_hint': 'access_token'
}
introspection = requests.post(
url=INTROSPECTION_ENDPOINT,
data=data,
headers={
'Content-Type': 'application/x-www-form-urlencoded'
}
)