
Good day 👋
I am making a Python-based Appwrite function and I see that generally, this is done by accepting a file structured like this:
def main(context): return context.res.send("Hello World")
I was wondering if there is any information on what type/structure this "context" object has? Can it perhaps be imported from an SDK of be defined somewhere? I would love to know this for creating tests.


@ideclon thanks for the response. I already saw this page and guess I should have formulated the question differently.
Is there some Python definition of the context object? I.e. such that I can make a script like this:
def main(context: RuntimeContext):
return context.res.send("")```
In other words; this context object must have some class or data structure which is not specified in the documentation. This is relevant because I might want to write unittests that send such a context object, preferably without mocking an implementation and rather using the actual thing.

Python SDK doesn't have types, but there is a open issue an PR to implement it: https://github.com/appwrite/sdk-for-python/issues/43

Looking the PR seems like it doesn't include types for the context, you can comment the issue giving your feedback

We've been wanting to add better type support for open runtimes...not sure when we'll be able t oget to it

Alright, thanks for the info!

Just for future reference, I found the Context
object definition here https://github.com/open-runtimes/open-runtimes/blob/main/runtimes/python-3.10/src/server.py#L47-L70
This is what I was looking for 😀 thx again for the pointers

[SOLVED] Python context object
Recommended threads
- API preflight request not working on .f...
When I am calling a function on my APP through the domain is failing. Because the preflight request (OPTIONS HTTP request) times out. this only occurs with fu...
- No Headers
Hi I have 2 appwrite functions, one is working fine on localhost, second is not even working on prod with https, i inspected the api call, no headers are being ...
- Cloud Function Deployment crashing
My golang cloud function crashes on deployment and its a bit non-descript. Here is the error message. It says "Document already exists". This is a general probl...
