How to make an HTTP Request in AWS Lambda using Python

The requests module for Python is very useful in helping simplify HTTP/s requests from Python, but how would you use it in an AWS Lambda script?

While it is not immediately possible to just do a import requests and start using the module, it is possible to import it from the botocore.vendored top-level package.

Python on Lambda exposes a module for common packages called botocore that you can call in any Lambda script.

Using the requests library in Lambda

from botocore.vendored import requests

Once you have imported the requests library from botocore.vendored, you will be able to make use of all the functionality you are familiar with.

Make the HTTP request

from botocore.vendored import requests

response = requests.get("")
5 1 vote
Article Rating
Notify of
Inline Feedbacks
View all comments