aws / chalice

Python Serverless Microframework for AWS
Apache License 2.0
10.67k stars 1.01k forks source link

Unable to import module 'app': No module named 'requests' #2116

Closed marcelo-bn closed 3 months ago

marcelo-bn commented 3 months ago

Hello everyone.

I deployed the simple chalice project bellow, but I am getting this error: Unable to import module 'app': No module named 'requests'

The versions of imports are:

boto3==1.34.153
chalice==1.31.2
requests==2.32.3

Code:

from chalice import Chalice
import requests
from chalicelib.get_parameter import get_parameter

app = Chalice(app_name='project3')

@app.schedule('rate(1 minute)')
def every_minute(event):
    api_key = get_parameter(parameter="api-key")    
    response = requests.get(f"https://v6.exchangerate-api.com/v6/{api_key}/latest/BRL")
    data = response.json()
    print(f">>> {data}")

Can you guys help me with this?

marcelo-bn commented 3 months ago

I solved the problem using the urllib3 lib instead of requests