Send Post request to an external API using AWS Lambda in python

前端 未结 2 539
南方客
南方客 2021-01-01 01:07

I want to send a post request to an external API (https://example.com/api/jobs/test) every hour.

The Lambda Function that I used is as follows:

Handl         


        
相关标签:
2条回答
  • 2021-01-01 01:41

    Vendored requests are now removed from botocore.

    Consider packaging your Lambda code with requirements.txt using CloudFormation package or SAM CLI packaging functionality.

    My older answer from before vendored requests deprecation: You may be able to leverage requests module from the boto library without having to install or package your function.

    Consider this import: import botocore.vendored.requests as requests

    0 讨论(0)
  • 2021-01-01 01:42

    You need to install requests module to your project directory and create a lambda deployment package. See this link for details.

    In short, you need to create your index.py file on you development system (PC or mac), install Python & pip on that system; them follow the steps in the doc. To create lambda, choose the 'Upload zip' option instead of the 'Edit inline' one

    0 讨论(0)
提交回复
热议问题