I am trying to make a put request in AWS lambda. Requests does not comes by default in the python lambda runtime (I know it can be installed using pip and uploading a zip file but this is not what I want.), and requests from botocore is going to get retired soon, so I the only thing I have left is urllib3.
This is how I would do normally using the requests module:
import requests
response_body = {'Status': 'SUCCESS',
'Reason': 'whatever'}
requests.put(url, data=json.dumps(response_body))
How can I do the same using urllib3?
I guess it was pretty similar:
import urllib3
http = urllib3.PoolManager()
response_body = {'Status': 'SUCCESS',
'Reason': 'whatever'}
r = http.request('PUT', event['ResponseURL'],body=json.dumps(response_body))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With