Python At AWS Lambda: `requests` From Botocore.vendored Deprecated, But `requests` Not Available

I've got a Python script for an AWS Lambda function that does HTTP POST requests to another endpoint. Since Python's urllib2.request,, can only handle data in the standard application/x-www-form-urlencoded format and I want to post JSON data, I used the Requests library,

That Requests library wasn't available at AWS Lambda in the Python runtime environment, so had to be imported via from botocore.vendored import requests. So far, so good.

Today, I get a deprecation warning on that:

DeprecationWarning: You are using the post() function from 'botocore.vendored.requests'.
This is not a public API in botocore and will be removed in the future.
Additionally, this version of requests is out of date. We recommend you install the
requests package, 'import requests' directly, and use the function instead.

This was mentioned in this blog post from AWS too:

Unfortunately, changing from botocore.vendored import requests into import requests results in the following error:

No module named 'requests'

Why is requests not available for the Python runtime at AWS Lambda? And how can I use / import it?



If you are using serverless framework

Specify the plugin in serverless.yml

- serverless-python-requirements

At the directory root create file requirements.txt



This will install the requests and packages mentioned.