Requests – vendored with boto3

09 Nov, 2018
Xebia Background Header Wave

This blog content has been deprecated as Amazon announced the removal of the requests library from the botocore packaging. So this content is no longer appropriate.
Requests is a popular HTTP library for Python. The library makes it
easy to call HTTP services and process JSON responses. Boto3 is
the AWS SDK for AWS. When creating a Lambda with the Python programming language, Boto3 is available. There is no need to
package Boto3. Because requests comes vendored with Boto3, it is also available.

Importing vendored requests

Import the following:

import botocore.vendored.requests as requests
from botocore.vendored.requests.auth import HTTPBasicAuth

resp =
    json={'message': 'hello world'}, 
    auth=HTTPBasicAuth('username', 'password'), 
body = resp.json()
code = resp.status_code


There is no need to package requests or Boto3 when creating a lambda. Both are available for python based lambdas.
The advantage is a small archive and being being able to inline lambdas in a CloudFormation template, which I will
write about in the next blog.


Get in touch with us to learn more about the subject and related solutions

Explore related posts