Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
# Change Log

## 14.1.1

* Update SDK as per latest server specs, these include -
* Updates to Runtime enums
* `Output` is now renamed to `ImageFormat` - Note that this is a breaking change
* Introduces Backups module for managing Database backups
* Introduces Organization module

## 14.1.0

* Added ability to create columns and indexes synchronously while creating a table

## 14.0.0

* Rename `VCSDeploymentType` enum to `VCSReferenceType`
* Change `create_template_deployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters
* Change `create_template_deployment` method signature: replace `version` parameter with `type` (TemplateReferenceType)
and `reference` parameters
* Add `get_screenshot` method to `Avatars` service
* Add `Theme`, `Timezone` and `Output` enums
* Add support for dart39 and flutter335 runtimes
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors.
Copyright (c) 2026 Appwrite (https://appwrite.io) and individual contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Appwrite Python SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.8.1-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.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).**
**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).**

Appwrite is an open-source backend as a service server that abstract and simplify 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](https://appwrite.io/docs)
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](https://appwrite.io/docs)

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

Expand Down
4 changes: 2 additions & 2 deletions appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ def __init__(self):
self._endpoint = 'https://cloud.appwrite.io/v1'
self._global_headers = {
'content-type': '',
'user-agent' : f'AppwritePythonSDK/14.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'user-agent' : f'AppwritePythonSDK/14.1.1 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'x-sdk-name': 'Python',
'x-sdk-platform': 'server',
'x-sdk-language': 'python',
'x-sdk-version': '14.1.0',
'x-sdk-version': '14.1.1',
'X-Appwrite-Response-Format' : '1.8.0',
}

Expand Down
8 changes: 2 additions & 6 deletions appwrite/encoders/value_class_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ..enums.flag import Flag
from ..enums.theme import Theme
from ..enums.timezone import Timezone
from ..enums.output import Output
from ..enums.image_format import ImageFormat
from ..enums.relationship_type import RelationshipType
from ..enums.relation_mutate import RelationMutate
from ..enums.index_type import IndexType
Expand All @@ -24,7 +24,6 @@
from ..enums.adapter import Adapter
from ..enums.compression import Compression
from ..enums.image_gravity import ImageGravity
from ..enums.image_format import ImageFormat
from ..enums.password_hash import PasswordHash
from ..enums.messaging_provider_type import MessagingProviderType
from ..enums.database_type import DatabaseType
Expand Down Expand Up @@ -64,7 +63,7 @@ def default(self, o):
if isinstance(o, Timezone):
return o.value

if isinstance(o, Output):
if isinstance(o, ImageFormat):
return o.value

if isinstance(o, RelationshipType):
Expand Down Expand Up @@ -115,9 +114,6 @@ def default(self, o):
if isinstance(o, ImageGravity):
return o.value

if isinstance(o, ImageFormat):
return o.value

if isinstance(o, PasswordHash):
return o.value

Expand Down
3 changes: 0 additions & 3 deletions appwrite/enums/build_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ class BuildRuntime(Enum):
PYTHON_3_12 = "python-3.12"
PYTHON_ML_3_11 = "python-ml-3.11"
PYTHON_ML_3_12 = "python-ml-3.12"
DENO_1_21 = "deno-1.21"
DENO_1_24 = "deno-1.24"
DENO_1_35 = "deno-1.35"
DENO_1_40 = "deno-1.40"
DENO_1_46 = "deno-1.46"
DENO_2_0 = "deno-2.0"
Expand Down
1 change: 1 addition & 0 deletions appwrite/enums/name.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ class Name(Enum):
V1_WEBHOOKS = "v1-webhooks"
V1_CERTIFICATES = "v1-certificates"
V1_BUILDS = "v1-builds"
V1_SCREENSHOTS = "v1-screenshots"
V1_MESSAGING = "v1-messaging"
V1_MIGRATIONS = "v1-migrations"
1 change: 0 additions & 1 deletion appwrite/enums/o_auth_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ class OAuthProvider(Enum):
YANDEX = "yandex"
ZOHO = "zoho"
ZOOM = "zoom"
MOCK = "mock"
10 changes: 0 additions & 10 deletions appwrite/enums/output.py

This file was deleted.

3 changes: 0 additions & 3 deletions appwrite/enums/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ class Runtime(Enum):
PYTHON_3_12 = "python-3.12"
PYTHON_ML_3_11 = "python-ml-3.11"
PYTHON_ML_3_12 = "python-ml-3.12"
DENO_1_21 = "deno-1.21"
DENO_1_24 = "deno-1.24"
DENO_1_35 = "deno-1.35"
DENO_1_40 = "deno-1.40"
DENO_1_46 = "deno-1.46"
DENO_2_0 = "deno-2.0"
Expand Down
2 changes: 0 additions & 2 deletions appwrite/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import math
from enum import Enum


class Condition(Enum):
EQUAL = "equal"
NOT_EQUAL = "notEqual"
Expand All @@ -14,7 +13,6 @@ class Condition(Enum):
IS_NULL = "isNull"
IS_NOT_NULL = "isNotNull"


class Operator():
def __init__(self, method, values=None):
self.method = method
Expand Down
1 change: 0 additions & 1 deletion appwrite/query.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json


# Inherit from dict to allow for easy serialization
class Query():
def __init__(self, method, attribute=None, values=None):
Expand Down
1 change: 0 additions & 1 deletion appwrite/service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from .client import Client


class Service:
def __init__(self, client: Client):
self.client = client
10 changes: 9 additions & 1 deletion appwrite/services/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,15 @@ def delete_identity(self, identity_id: str) -> Dict[str, Any]:
'content-type': 'application/json',
}, api_params)

def create_jwt(self) -> Dict[str, Any]:
def create_jwt(self, duration: Optional[float] = None) -> Dict[str, Any]:
"""
Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.

Parameters
----------
duration : Optional[float]
Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.

Returns
-------
Dict[str, Any]
Expand All @@ -203,6 +208,9 @@ def create_jwt(self) -> Dict[str, Any]:
api_path = '/account/jwts'
api_params = {}

if duration is not None:
api_params['duration'] = duration

return self.client.call('post', api_path, {
'content-type': 'application/json',
}, api_params)
Expand Down
6 changes: 3 additions & 3 deletions appwrite/services/avatars.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ..enums.flag import Flag;
from ..enums.theme import Theme;
from ..enums.timezone import Timezone;
from ..enums.output import Output;
from ..enums.image_format import ImageFormat;

class Avatars(Service):

Expand Down Expand Up @@ -317,7 +317,7 @@ def get_qr(self, text: str, size: Optional[float] = None, margin: Optional[float
return self.client.call('get', api_path, {
}, api_params)

def get_screenshot(self, url: str, headers: Optional[dict] = None, viewport_width: Optional[float] = None, viewport_height: Optional[float] = None, scale: Optional[float] = None, theme: Optional[Theme] = None, user_agent: Optional[str] = None, fullpage: Optional[bool] = None, locale: Optional[str] = None, timezone: Optional[Timezone] = None, latitude: Optional[float] = None, longitude: Optional[float] = None, accuracy: Optional[float] = None, touch: Optional[bool] = None, permissions: Optional[List[str]] = None, sleep: Optional[float] = None, width: Optional[float] = None, height: Optional[float] = None, quality: Optional[float] = None, output: Optional[Output] = None) -> bytes:
def get_screenshot(self, url: str, headers: Optional[dict] = None, viewport_width: Optional[float] = None, viewport_height: Optional[float] = None, scale: Optional[float] = None, theme: Optional[Theme] = None, user_agent: Optional[str] = None, fullpage: Optional[bool] = None, locale: Optional[str] = None, timezone: Optional[Timezone] = None, latitude: Optional[float] = None, longitude: Optional[float] = None, accuracy: Optional[float] = None, touch: Optional[bool] = None, permissions: Optional[List[str]] = None, sleep: Optional[float] = None, width: Optional[float] = None, height: Optional[float] = None, quality: Optional[float] = None, output: Optional[ImageFormat] = None) -> bytes:
"""
Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image.

Expand Down Expand Up @@ -365,7 +365,7 @@ def get_screenshot(self, url: str, headers: Optional[dict] = None, viewport_widt
Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height).
quality : Optional[float]
Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
output : Optional[Output]
output : Optional[ImageFormat]
Output format type (jpeg, jpg, png, gif and webp).

Returns
Expand Down
Loading