Metadata-Version: 2.4
Name: appwrite-console
Version: 0.2.1
Summary: Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API
Home-page: https://appwrite.io/support
Download-URL: https://github.com/appwrite/sdk-for-console-python/archive/0.2.1.tar.gz
Author: Appwrite Team
Author-email: Appwrite Team <team@appwrite.io>
Maintainer: Appwrite Team
Maintainer-email: Appwrite Team <team@appwrite.io>
License: BSD-3-Clause
Project-URL: Homepage, https://appwrite.io/support
Project-URL: Repository, https://github.com/appwrite/sdk-for-console-python
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Environment :: Web Environment
Classifier: Topic :: Software Development
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: pydantic<3,>=2
Provides-Extra: test
Requires-Dist: requests_mock==1.11.0; extra == "test"
Dynamic: author
Dynamic: download-url
Dynamic: home-page
Dynamic: license-file
Dynamic: maintainer
Dynamic: requires-python

# Appwrite Console Python SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-console-python.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.6-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console-python/releases).**

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 Console 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](https://appwrite.io/docs)

![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png)

## Installation

To install via [PyPI](https://pypi.org/):

```bash
pip install appwrite-console
```

Or with `uv`:

```bash
uv add appwrite-console
```


## Getting Started

The Appwrite Console SDK for Python drives the Console API — organizations, projects,
billing, and everything else the Console itself calls. It is separate from
[sdk-for-python](https://github.com/appwrite/sdk-for-python), which targets the public
server API.

### Installation

```bash
pip install appwrite-console
```

The package installs as `appwrite-console` and imports as `appwrite_console`, so it can
sit alongside `appwrite` in the same environment.

**Requirements:** Python 3.9+

### Init your SDK

```python
from appwrite_console.client import Client

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1')
client.set_project('console')
client.set_session('your-console-session')
```

Console endpoints authenticate as a Console user, not with a project API key. Use
`set_session()` with a Console session, or `set_jwt()` where you hold a token.

For a self-hosted instance with a self-signed certificate:

```python
client.set_self_signed(True)  # Dev only
```

### Organizations

```python
from appwrite_console.services.organizations import Organizations

organizations = Organizations(client)

result = organizations.list()
for organization in result.teams:
    print(organization.id, organization.name)
```

### Projects

Projects are scoped to an organization:

```python
from appwrite_console.services.organization import Organization

organization = Organization(client)
organization.client.set_organization('your-organization-id')

projects = organization.list_projects()
for project in projects.projects:
    print(project.id, project.name)

project = organization.get_project('your-project-id')
```

### Queries

```python
from appwrite_console.query import Query

result = organization.list_projects(queries=[
    Query.limit(25),
    Query.order_desc('$createdAt'),
])
```

### Error handling

```python
from appwrite_console.exception import AppwriteException

try:
    project = organization.get_project('missing-project')
except AppwriteException as error:
    print(error.message, error.code, error.type)
```

### Full example

```python
from appwrite_console.client import Client
from appwrite_console.services.organizations import Organizations
from appwrite_console.services.organization import Organization
from appwrite_console.exception import AppwriteException

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1')
client.set_project('console')
client.set_session('your-console-session')

organizations = Organizations(client)
organization = Organization(client)

try:
    for team in organizations.list().teams:
        client.set_organization(team.id)

        for project in organization.list_projects().projects:
            print(f'{team.name} / {project.name} ({project.id})')
except AppwriteException as error:
    print(f'Error: {error.message}')
```


## Contribution

This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request.

## License

Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information.
