[ERROR] AttributeError: module 'botocore.vendored.requests' has no attribute 'post' despite having import requests
See original GitHub issueDescribe the bug
[ERROR] AttributeError: module 'botocore.vendored.requests' has no attribute 'post'
Steps to reproduce
import requests
import json
def resume(url, headers):
requests.post(url, data={}, headers=headers)
def scheduleResumption(api_access_token, session_id):
headers = {
'Authorization': f'Bearer {api_access_token}',
'Content-Type': 'application/json',
}
t = Timer(interval=30.0,
function=resume,
args=(f'https://api.amazonalexa.com/v1/_customSkillSessions/{session_id}/resume/', headers)
)
t.start()
Expected behavior for it to POST Debug logs
2020-11-13T02:23:33.842-05:00 [ERROR] AttributeError: module 'botocore.vendored.requests' has no attribute 'post'
Traceback (most recent call last):
File "/var/lang/lib/python3.8/imp.py", line 234, in load_module
return load_source(name, filename, file)
File "/var/lang/lib/python3.8/imp.py", line 171, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 702, in _load
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/var/task/lambda_function.py", line 86, in <module>
requests.post(url, data = myobj)
Runtime:
tried with python 3.8 & 3.7 & have a layer that had requests library in it.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
module 'botocore.vendored.requests' has no attribute 'Post ...
But I am not sure if I need to import certain things from Python. It fails when I'm about to post the message....
Read more >Don't Import requests From botocore.vendored
Importing from botocore.vendored is an anti-pattern in general, ... AttributeError: module 'botocore.vendored.requests' has no attribute ...
Read more >module 'botocore.vendored.requests' has no attribute エラー ...
[ERROR] AttributeError: module 'botocore.vendored.requests' has no attribute 'get' Traceback (most recent call last): File ...
Read more >Removing the vendored version of requests from Botocore
Starting 10/21/19, we will be removing the vendored version of the requests library in Botocore. In this post, we'll cover the key details....
Read more >AWS Blog - How to send yourself a daily inspirational quote ...
You will notice an error - "errorMessage": "module 'botocore.vendored.requests' has no attribute 'request'". For those new to coding, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@DaniyalDhz - I am using layer to add dependency to my lambda function and its working correctly. This is how i am uploading my dependency to my lambda function:
Then create a layer using this zip file and use this layer in your lambda function. In order for the dependency to work you have to put Python dependencies into either a
pythondirectory or intopython/lib/python<3.x>/site-packages.Let us know if you are still facing any issues.
Hi @DaniyalDhz,
Requests was removed from botocore a little over a year ago in version Botocore 1.13.0. We released a blog post on October 1, 2019 which has full details on the change. Going forward, you’ll want to install requests separately with
pip install requests.