
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
- Create owner team member with Server fun...
I understand that when creating a team with a function, the user that made the request will not be the owner so I think I have to add the user that did the requ...
- Schedule a function job with timezone
I am aware that cron schedule will work on UTC timezone. I would like to run my function at a particular time everyday in new york time. If I use UTC, it will m...
- Appwrite processing global envs and chan...
So I define a global env - GCP_CREDENTIALS in global env of my appwrite projcet and refer to it in my functions as ```gcp_creds: JSON.PARSE(GCP_CREDENTIALS)```...
