GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - appwrite/sdk-for-python: [READ-ONLY] Official Appwrite Python SDK 🐍

BranchesTags
Open more actions menu

Latest commit

 

History

408 Commits
408 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
appwrite
appwrite
 
 
docs/examples
docs/examples
 
 
test
test
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pyproject.toml
pyproject.toml
 
 
requirements.txt
requirements.txt
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 

Repository files navigation

Appwrite Python SDK

License Version X Account Discord

This SDK targets Appwrite server version 2.7.x as shipped on Appwrite Cloud. Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from previous releases when APIs differ.

Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Python SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to https://appwrite.io/docs

Appwrite

Installation

Requires Python 3.10 or later. Install the appwrite package from PyPI:

pip install appwrite

Or with uv:

uv add appwrite

Getting started

Requirements and installation

Use Python 3.10 or later. Create and activate a virtual environment with that interpreter, then install the SDK:

python -m pip install --upgrade appwrite

The SDK requires requests>=2.34.2,<3 and urllib3>=2.8.0,<3. Update application pins or constraints that exclude these versions.

Initialize the client

Create a client with your Appwrite endpoint, project ID and an API key. Find the endpoint and project ID in your project's Settings page, and create an API key with only the scopes you need under API keys in the project sidebar.

from appwrite.client import Client

client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1')
client.set_project('<PROJECT_ID>')
client.set_key('<API_KEY>')

API keys grant server-level access to your project. Keep them out of client-side code and version control.

Make a request

Create a service object with the client and call any of its methods. Every method returns a typed Pydantic model, so response fields are available as attributes.

from appwrite.id import ID
from appwrite.services.users import Users

users = Users(client)

user = users.create(
    user_id=ID.unique(),
    email='[email protected]',
    password='password',
    name="Walter O'Brien",
)

print(user.id)
print(user.name)
print(user.to_dict())

See the API reference for every service and method.

Work with rows

Use TablesDB to read and write rows. Pass a Pydantic model as model_type to get typed row data back; without it, row.data is a dict.

from typing import Optional

from pydantic import BaseModel

from appwrite.id import ID
from appwrite.query import Query
from appwrite.services.tables_db import TablesDB


class Post(BaseModel):
    title: str
    published: bool
    excerpt: Optional[str] = None


tables_db = TablesDB(client)

row = tables_db.create_row(
    database_id='<DATABASE_ID>',
    table_id='<TABLE_ID>',
    row_id=ID.unique(),
    data={'title': 'Hello, world', 'published': True},
    model_type=Post,
)

print(row.id)
print(row.data.title)

result = tables_db.list_rows(
    database_id='<DATABASE_ID>',
    table_id='<TABLE_ID>',
    queries=[Query.equal('published', True), Query.limit(25)],
    model_type=Post,
)

for row in result.rows:
    print(row.data.title)

Handle errors

Failed requests raise AppwriteException, which carries message, code, type and response.

from appwrite.exception import AppwriteException

try:
    user = users.get(user_id='<USER_ID>')
except AppwriteException as error:
    print(error.code, error.type, error.message)

Self-hosted Appwrite

Point the client at your own instance instead of Appwrite Cloud. Call set_self_signed() only in development, when the server uses a self-signed TLS certificate.

client.set_endpoint('https://appwrite.example.com/v1')
client.set_self_signed()

Learn more

  • Python quick start
  • Python API reference
  • Appwrite docs
  • Discord community
  • Appwrite Python playground

Contribution

This library is auto-generated by Appwrite custom SDK Generator. To learn more about how you can help us improve this SDK, please check the contribution guide before sending a pull-request.

License

Please see the BSD-3-Clause license file for more information.

About

[READ-ONLY] Official Appwrite Python SDK 🐍

appwrite.io

Topics

appwritebaashacktoberfestpython

Resources

Readme
BSD-3-Clause license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

265 stars

Watchers

19 watching

Forks

67 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.