Skip to content

Instantly share code, notes, and snippets.

@bizrockman
Last active October 25, 2024 09:09
Show Gist options
  • Save bizrockman/13bb04afa1b69a0662f4ad29f4b57c3a to your computer and use it in GitHub Desktop.
Save bizrockman/13bb04afa1b69a0662f4ad29f4b57c3a to your computer and use it in GitHub Desktop.
Create an appwrite Client in Python
from appwrite.client import Client
from dotenv import load_dotenv
def init_appwrite_client() -> Client:
'''
Init Appwrite client and return Databases object
'''
client = Client()
client.set_endpoint(os.getenv("APPWRITE_ENDPOINT"))
client.set_project(os.getenv("APPWRITE_PROJECT_ID"))
client.set_key(os.getenv("APPWRITE_API_KEY"))
#client.set_self_signed(True)
return client
load_dotenv()
appwrite_client: Client = init_appwrite_client()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment