From 3b23ebc93717b8314c4bfb92f32e9fd66b344d65 Mon Sep 17 00:00:00 2001 From: shimon Date: Tue, 1 Dec 2026 14:43:22 +0200 Subject: [PATCH] chore: update Python SDK to 28.5.0 Co-Authored-By: Claude Fable 5.2 --- CHANGELOG.md | 6 ++++++ appwrite/client.py | 4 ++-- appwrite/enums/project_key_scopes.py | 1 - appwrite/models/video.py | 6 ++++++ appwrite/services/videos.py | 20 ++++++++++---------- pyproject.toml | 2 +- setup.py | 4 ++-- test/services/test_videos.py | 3 +++ 8 files changed, 30 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b65fe39b..30ecda90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 28.5.0 + +* Removed: `ProjectKeyScopes.VIDEOS_PLAY`; video playback is covered by the `videos.read` scope +* Added: `renditions` to the `Video` model, listing the video's ready renditions +* Updated: `videos` method docs to describe guest playback under `videos.read` + ## 28.4.0 * Added: `analytics` service to create, list, get, update and delete analytics properties diff --git a/appwrite/client.py b/appwrite/client.py index 1f6992d0..5aa79898 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -20,11 +20,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent': f'AppwritePythonSDK/28.4.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent': f'AppwritePythonSDK/28.5.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '28.4.0', + 'x-sdk-version': '28.5.0', 'X-Appwrite-Response-Format': '2.7.2', } self._config = {} diff --git a/appwrite/enums/project_key_scopes.py b/appwrite/enums/project_key_scopes.py index 76ec3b84..69a94cbc 100644 --- a/appwrite/enums/project_key_scopes.py +++ b/appwrite/enums/project_key_scopes.py @@ -116,7 +116,6 @@ class ProjectKeyScopes(Enum): REVIEWS_WRITE = "reviews.write" PRESENCES_READ = "presences.read" PRESENCES_WRITE = "presences.write" - VIDEOS_PLAY = "videos.play" VIDEOS_READ = "videos.read" VIDEOS_WRITE = "videos.write" DEDICATEDDATABASES_EXECUTE = "dedicatedDatabases.execute" diff --git a/appwrite/models/video.py b/appwrite/models/video.py index c19a8761..ba5a8a7a 100644 --- a/appwrite/models/video.py +++ b/appwrite/models/video.py @@ -3,6 +3,7 @@ from .base_model import AppwriteModel from ..enums.video_timeline_status import VideoTimelineStatus +from .video_rendition import VideoRendition class Video(AppwriteModel): @@ -61,6 +62,8 @@ class Video(AppwriteModel): Thumbnail timeline job status: one of `pending`, `started`, `ready`, `skipped` (source has no video track) or `error`. timelineerror : str Why the timeline job failed. Empty unless `timelineStatus` is `error`. + renditions : List[VideoRendition] + Ready renditions of the video, lowest resolution first. """ id: str = Field(..., alias='$id') @@ -88,6 +91,7 @@ class Video(AppwriteModel): audiosamplerate: float = Field(..., alias='audioSampleRate') timelinestatus: VideoTimelineStatus = Field(..., alias='timelineStatus') timelineerror: str = Field(..., alias='timelineError') + renditions: List[VideoRendition] = Field(..., alias='renditions') @model_validator(mode='before') @classmethod @@ -146,4 +150,6 @@ def _apply_defaults(cls, data: Any) -> Any: data['timelineStatus'] = 'pending' if 'timelineError' not in data and 'timelineerror' not in data: data['timelineError'] = '' + if 'renditions' not in data: + data['renditions'] = [] return data diff --git a/appwrite/services/videos.py b/appwrite/services/videos.py index db6074e9..011158b8 100644 --- a/appwrite/services/videos.py +++ b/appwrite/services/videos.py @@ -25,7 +25,7 @@ def list( total: Optional[bool] = None, ) -> VideoList: """ - Get a list of videos in the current project. Sessions receive only videos they can read according to each video's `$permissions`. API keys and admins receive the full project catalog. Playback uses the same document read ACL plus the `videos.play` (or `videos.read`) scope: a guest can stream a video that grants `read("any")` or `read("guests")` even though guests lack `videos.read` and will not see it in this list. + Get a list of videos in the current project. Sessions and guests receive only videos they can read according to each video's `$permissions`. API keys and admins receive the full project catalog. Each video includes its ready renditions. Guests hold `videos.read`, so a video that grants `read("any")` or `read("guests")` appears in this list and can be streamed. Parameters ---------- @@ -74,7 +74,7 @@ def create( """ Create a video resource from an existing file in a storage bucket. The source file must be a video or audio file, and the caller must be able to read that file. Creating a video stores the document and queues timeline generation. The worker downloads the source, probes metadata, extracts embedded captions once, and deletes its working copy when finished. Sources with a video track also get a thumbnail timeline. Call create-rendition to package a streaming output. - An optional `name` defaults to the source file name. An optional `permissions` array sets the video document ACL (list, get, update, delete, manage child resources, and playback). By default, only the current user is granted all permissions; API keys and admins create with empty permissions when omitted. Guests with `videos.play` can stream when the video grants them read (`read("any")` or `read("guests")`). + An optional `name` defaults to the source file name. An optional `permissions` array sets the video document ACL (list, get, update, delete, manage child resources, and playback). By default, only the current user is granted all permissions; API keys and admins create with empty permissions when omitted. Guests can stream when the video grants them read (`read("any")` or `read("guests")`). Uploaded caption files stay listed alongside auto-extracted tracks for the same language; when the current default is an auto-extracted track with that code, the upload takes the default flag. @@ -166,7 +166,7 @@ def get( video_id: str, ) -> Video: """ - Get a video by its unique ID. This endpoint response returns a JSON object with the video metadata. + Get a video by its unique ID. This endpoint response returns a JSON object with the video metadata, including ready renditions. Parameters ---------- @@ -541,7 +541,7 @@ def get_cmaf_hls_manifest( """ Get the top-level streaming manifest for a video output: an HLS master playlist (`master.m3u8`) or a DASH MPD (`master.mpd`). Hand this URL to a player to begin adaptive playback. - Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session. + Guests can request this URL when they hold `videos.read` **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session. For CMAF renditions, use `getCmafHlsManifest` or `getCmafDashManifest`. Both masters point at the same fMP4 segment set. @@ -585,7 +585,7 @@ def get_cmaf_dash_manifest( """ Get the top-level streaming manifest for a video output: an HLS master playlist (`master.m3u8`) or a DASH MPD (`master.mpd`). Hand this URL to a player to begin adaptive playback. - Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session. + Guests can request this URL when they hold `videos.read` **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session. For CMAF renditions, use `getCmafHlsManifest` or `getCmafDashManifest`. Both masters point at the same fMP4 segment set. @@ -629,7 +629,7 @@ def get_dash_manifest( """ Get the top-level streaming manifest for a video output: an HLS master playlist (`master.m3u8`) or a DASH MPD (`master.mpd`). Hand this URL to a player to begin adaptive playback. - Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session. + Guests can request this URL when they hold `videos.read` **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session. For CMAF renditions, use `getCmafHlsManifest` or `getCmafDashManifest`. Both masters point at the same fMP4 segment set. @@ -673,7 +673,7 @@ def get_hls_manifest( """ Get the top-level streaming manifest for a video output: an HLS master playlist (`master.m3u8`) or a DASH MPD (`master.mpd`). Hand this URL to a player to begin adaptive playback. - Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session. + Guests can request this URL when they hold `videos.read` **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session. For CMAF renditions, use `getCmafHlsManifest` or `getCmafDashManifest`. Both masters point at the same fMP4 segment set. @@ -719,7 +719,7 @@ def get_caption_manifest( """ Get the playable caption resource for a video output: an HLS captions playlist, or the WebVTT file itself for DASH. - Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read. + Guests can request this URL when they hold `videos.read` **and** the video document grants them read. Parameters ---------- @@ -981,7 +981,7 @@ def get_thumbnail( """ Get a single thumbnail sheet from a video's timeline as an image. You can resize the returned image and choose its output format. - Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read. + Guests can request this URL when they hold `videos.read` **and** the video document grants them read. Parameters ---------- @@ -1040,7 +1040,7 @@ def get_timeline( """ Get the WebVTT thumbnail timeline for a video, used to render scrubbing thumbnails in a player. Timeline generation is queued when the video is created. Subscribe to `videos.[videoId].timelines.update` for probe and terminal updates, or poll this endpoint until it returns a WebVTT document. Audio-only sources produce no timeline and this endpoint returns `video_timelines_not_found`. - Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session. + Guests can request this URL when they hold `videos.read` **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session. Parameters ---------- diff --git a/pyproject.toml b/pyproject.toml index 42b2d757..8942a823 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "appwrite" -version = "28.4.0" +version = "28.5.0" description = "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API" readme = "README.md" requires-python = ">=3.10" diff --git a/setup.py b/setup.py index c5829a9c..68883e4f 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name='appwrite', packages=setuptools.find_packages(), - version='28.4.0', + version='28.5.0', license='BSD-3-Clause', description='Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API', long_description=long_description, @@ -18,7 +18,7 @@ maintainer='Appwrite Team', maintainer_email='team@appwrite.io', url='https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/28.4.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/28.5.0.tar.gz', install_requires=[ 'requests>=2.34.2,<3', 'urllib3>=2.8.0,<3', diff --git a/test/services/test_videos.py b/test/services/test_videos.py index 4eb54226..d034eb34 100644 --- a/test/services/test_videos.py +++ b/test/services/test_videos.py @@ -76,6 +76,7 @@ def test_create(self, m): "audioSampleRate": 48000.0, "timelineStatus": "ready", "timelineError": "The requested file is not a valid video or audio file (ffprobe: Invalid data found when processing input)", + "renditions": [], } headers = {'Content-Type': 'application/json'} m.request( @@ -162,6 +163,7 @@ def test_get(self, m): "audioSampleRate": 48000.0, "timelineStatus": "ready", "timelineError": "The requested file is not a valid video or audio file (ffprobe: Invalid data found when processing input)", + "renditions": [], } headers = {'Content-Type': 'application/json'} m.request( @@ -211,6 +213,7 @@ def test_update(self, m): "audioSampleRate": 48000.0, "timelineStatus": "ready", "timelineError": "The requested file is not a valid video or audio file (ffprobe: Invalid data found when processing input)", + "renditions": [], } headers = {'Content-Type': 'application/json'} m.request(