Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug Report: can't import certain python built-ins for functions #5626

Closed
2 tasks done
Ananya2001-an opened this issue Jun 1, 2023 · 2 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@Ananya2001-an
Copy link

馃憻 Reproduction steps

I did a manual deployment and this was my main.py file: (took from the docs)

If I remove the requests module it works else not :(

import random
import requests

def main(req, res):
  payload = req.payload or 'No payload provided. Add custom data when executing function.'

  secretKey = req.variables.get(
    'SECRET_KEY',
    'SECRET_KEY variable not found. You can set it in Function settings.'
  )

  randomNumber = random.random()

  trigger = req.variables['APPWRITE_FUNCTION_TRIGGER']

  return res.json({
    'message': 'Hello from Appwrite!',
    'payload': payload,
    'randomNumber': randomNumber,
    'trigger': trigger
  })

馃憤 Expected behavior

I am trying to implement a function where on event trigger like collection update I will send some data to a server but I noticed that it's failing every time....on doing a bit of trial and error I realized that it's not allowing me to import 'requests' module....without it everything works fine...

馃憥 Actual Behavior

It's failing because of the requests import...

馃幉 Appwrite version

Appwrite Cloud

馃捇 Operating system

Windows

馃П Your Environment

Appwrite cloud functions with Python runtime

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@Ananya2001-an Ananya2001-an added the bug Something isn't working label Jun 1, 2023
@gewenyu99
Copy link

Hi, requests is not a built in library/system library from Python.

You can use a requirements.txt to install it
https://pypi.org/project/requests/

@Ananya2001-an
Copy link
Author

Thanks @gewenyu99 I actually resolved it from the official discord support channel and it works now :) thnx again...I will close it now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants