From 54c05a4b657b388a88e52a4e30748ce2b67a6930 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 17 Apr 2025 19:55:00 +0100 Subject: [PATCH 1/2] fix: remove content-type from GET requests --- README.md | 2 +- appwrite/client.py | 7 ++- appwrite/enums/name.py | 1 - appwrite/enums/o_auth_provider.py | 1 + appwrite/services/account.py | 11 +--- appwrite/services/avatars.py | 7 --- appwrite/services/databases.py | 10 ---- appwrite/services/functions.py | 11 ---- appwrite/services/health.py | 51 ------------------- appwrite/services/locale.py | 8 --- appwrite/services/messaging.py | 13 ----- appwrite/services/storage.py | 7 --- appwrite/services/teams.py | 5 -- appwrite/services/users.py | 11 ---- .../health/get-queue-stats-usage-dump.md | 13 ----- setup.py | 4 +- 16 files changed, 10 insertions(+), 152 deletions(-) delete mode 100644 docs/examples/health/get-queue-stats-usage-dump.md diff --git a/README.md b/README.md index 466c7ac..c16cd61 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # 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.6.1-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.6.2-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) diff --git a/appwrite/client.py b/appwrite/client.py index a65edeb..ce46fde 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,11 +14,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/9.0.3 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/9.0.4 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '9.0.3', + 'x-sdk-version': '9.0.4', 'X-Appwrite-Response-Format' : '1.6.0', } @@ -27,6 +27,9 @@ def set_self_signed(self, status=True): return self def set_endpoint(self, endpoint): + if not endpoint.startswith('http://') and not endpoint.startswith('https://'): + raise AppwriteException('Invalid endpoint URL: ' + endpoint) + self._endpoint = endpoint return self diff --git a/appwrite/enums/name.py b/appwrite/enums/name.py index 0ac227e..c4b981e 100644 --- a/appwrite/enums/name.py +++ b/appwrite/enums/name.py @@ -8,7 +8,6 @@ class Name(Enum): V1_FUNCTIONS = "v1-functions" V1_STATS_RESOURCES = "v1-stats-resources" V1_STATS_USAGE = "v1-stats-usage" - V1_STATS_USAGE_DUMP = "v1-stats-usage-dump" V1_WEBHOOKS = "v1-webhooks" V1_CERTIFICATES = "v1-certificates" V1_BUILDS = "v1-builds" diff --git a/appwrite/enums/o_auth_provider.py b/appwrite/enums/o_auth_provider.py index 3d46c8e..6c1e6bd 100644 --- a/appwrite/enums/o_auth_provider.py +++ b/appwrite/enums/o_auth_provider.py @@ -15,6 +15,7 @@ class OAuthProvider(Enum): DROPBOX = "dropbox" ETSY = "etsy" FACEBOOK = "facebook" + FIGMA = "figma" GITHUB = "github" GITLAB = "gitlab" GOOGLE = "google" diff --git a/appwrite/services/account.py b/appwrite/services/account.py index d2fdf9a..9dd3c5e 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -29,7 +29,6 @@ def get(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create(self, user_id: str, email: str, password: str, name: str = None) -> Dict[str, Any]: @@ -145,7 +144,6 @@ def list_identities(self, queries: List[str] = None) -> Dict[str, Any]: api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_identity(self, identity_id: str) -> Dict[str, Any]: @@ -228,7 +226,6 @@ def list_logs(self, queries: List[str] = None) -> Dict[str, Any]: api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_mfa(self, mfa: bool) -> Dict[str, Any]: @@ -454,7 +451,6 @@ def list_mfa_factors(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_mfa_recovery_codes(self) -> Dict[str, Any]: @@ -476,7 +472,6 @@ def get_mfa_recovery_codes(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_mfa_recovery_codes(self) -> Dict[str, Any]: @@ -647,7 +642,6 @@ def get_prefs(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_prefs(self, prefs: dict) -> Dict[str, Any]: @@ -785,7 +779,6 @@ def list_sessions(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_sessions(self) -> Dict[str, Any]: @@ -1015,7 +1008,6 @@ def get_session(self, session_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_session(self, session_id: str) -> Dict[str, Any]: @@ -1205,7 +1197,7 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, fai Parameters ---------- provider : OAuthProvider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. + OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. success : str URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. failure : str @@ -1236,7 +1228,6 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, fai api_params['scopes'] = scopes return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params, response_type='location') def create_phone_token(self, user_id: str, phone: str) -> Dict[str, Any]: diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index efec859..36e15d8 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -50,7 +50,6 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, api_params['quality'] = quality return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_credit_card(self, code: CreditCard, width: float = None, height: float = None, quality: float = None) -> bytes: @@ -94,7 +93,6 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = api_params['quality'] = quality return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_favicon(self, url: str) -> bytes: @@ -128,7 +126,6 @@ def get_favicon(self, url: str) -> bytes: api_params['url'] = url return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_flag(self, code: Flag, width: float = None, height: float = None, quality: float = None) -> bytes: @@ -172,7 +169,6 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit api_params['quality'] = quality return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_image(self, url: str, width: float = None, height: float = None) -> bytes: @@ -214,7 +210,6 @@ def get_image(self, url: str, width: float = None, height: float = None) -> byte api_params['height'] = height return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_initials(self, name: str = None, width: float = None, height: float = None, background: str = None) -> bytes: @@ -257,7 +252,6 @@ def get_initials(self, name: str = None, width: float = None, height: float = No api_params['background'] = background return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_qr(self, text: str, size: float = None, margin: float = None, download: bool = None) -> bytes: @@ -299,5 +293,4 @@ def get_qr(self, text: str, size: float = None, margin: float = None, download: api_params['download'] = download return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index facfdea..0335087 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -39,7 +39,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Any]: @@ -113,7 +112,6 @@ def get(self, database_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Any]: @@ -224,7 +222,6 @@ def list_collections(self, database_id: str, queries: List[str] = None, search: api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_collection(self, database_id: str, collection_id: str, name: str, permissions: List[str] = None, document_security: bool = None, enabled: bool = None) -> Dict[str, Any]: @@ -315,7 +312,6 @@ def get_collection(self, database_id: str, collection_id: str) -> Dict[str, Any] return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_collection(self, database_id: str, collection_id: str, name: str, permissions: List[str] = None, document_security: bool = None, enabled: bool = None) -> Dict[str, Any]: @@ -447,7 +443,6 @@ def list_attributes(self, database_id: str, collection_id: str, queries: List[st api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_boolean_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: bool = None, array: bool = None) -> Dict[str, Any]: @@ -1625,7 +1620,6 @@ def get_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[ return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[str, Any]: @@ -1761,7 +1755,6 @@ def list_documents(self, database_id: str, collection_id: str, queries: List[str api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: List[str] = None) -> Dict[str, Any]: @@ -1862,7 +1855,6 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_document(self, database_id: str, collection_id: str, document_id: str, data: dict = None, permissions: List[str] = None) -> Dict[str, Any]: @@ -1997,7 +1989,6 @@ def list_indexes(self, database_id: str, collection_id: str, queries: List[str] api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_index(self, database_id: str, collection_id: str, key: str, type: IndexType, attributes: List[str], orders: List[str] = None) -> Dict[str, Any]: @@ -2101,7 +2092,6 @@ def get_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, Any]: diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index 7db7323..a483a22 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -39,7 +39,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create(self, function_id: str, name: str, runtime: Runtime, execute: List[str] = None, events: List[str] = None, schedule: str = None, timeout: float = None, enabled: bool = None, logging: bool = None, entrypoint: str = None, commands: str = None, scopes: List[str] = None, installation_id: str = None, provider_repository_id: str = None, provider_branch: str = None, provider_silent_mode: bool = None, provider_root_directory: str = None, template_repository: str = None, template_owner: str = None, template_root_directory: str = None, template_version: str = None, specification: str = None) -> Dict[str, Any]: @@ -162,7 +161,6 @@ def list_runtimes(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_specifications(self) -> Dict[str, Any]: @@ -185,7 +183,6 @@ def list_specifications(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get(self, function_id: str) -> Dict[str, Any]: @@ -217,7 +214,6 @@ def get(self, function_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update(self, function_id: str, name: str, runtime: Runtime = None, execute: List[str] = None, events: List[str] = None, schedule: str = None, timeout: float = None, enabled: bool = None, logging: bool = None, entrypoint: str = None, commands: str = None, scopes: List[str] = None, installation_id: str = None, provider_repository_id: str = None, provider_branch: str = None, provider_silent_mode: bool = None, provider_root_directory: str = None, specification: str = None) -> Dict[str, Any]: @@ -373,7 +369,6 @@ def list_deployments(self, function_id: str, queries: List[str] = None, search: api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_deployment(self, function_id: str, code: InputFile, activate: bool, entrypoint: str = None, commands: str = None, on_progress = None) -> Dict[str, Any]: @@ -472,7 +467,6 @@ def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any] return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: @@ -665,7 +659,6 @@ def get_deployment_download(self, function_id: str, deployment_id: str) -> bytes return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_executions(self, function_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: @@ -703,7 +696,6 @@ def list_executions(self, function_id: str, queries: List[str] = None, search: s api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_execution(self, function_id: str, body: str = None, xasync: bool = None, path: str = None, method: ExecutionMethod = None, headers: dict = None, scheduled_at: str = None) -> Dict[str, Any]: @@ -791,7 +783,6 @@ def get_execution(self, function_id: str, execution_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_execution(self, function_id: str, execution_id: str) -> Dict[str, Any]: @@ -862,7 +853,6 @@ def list_variables(self, function_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_variable(self, function_id: str, key: str, value: str) -> Dict[str, Any]: @@ -944,7 +934,6 @@ def get_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_variable(self, function_id: str, variable_id: str, key: str, value: str = None) -> Dict[str, Any]: diff --git a/appwrite/services/health.py b/appwrite/services/health.py index 23f5aa9..dd1d183 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -27,7 +27,6 @@ def get(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_antivirus(self) -> Dict[str, Any]: @@ -49,7 +48,6 @@ def get_antivirus(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_cache(self) -> Dict[str, Any]: @@ -71,7 +69,6 @@ def get_cache(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_certificate(self, domain: str = None) -> Dict[str, Any]: @@ -100,7 +97,6 @@ def get_certificate(self, domain: str = None) -> Dict[str, Any]: api_params['domain'] = domain return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_db(self) -> Dict[str, Any]: @@ -122,7 +118,6 @@ def get_db(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_pub_sub(self) -> Dict[str, Any]: @@ -144,7 +139,6 @@ def get_pub_sub(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_builds(self, threshold: float = None) -> Dict[str, Any]: @@ -173,7 +167,6 @@ def get_queue_builds(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_certificates(self, threshold: float = None) -> Dict[str, Any]: @@ -202,7 +195,6 @@ def get_queue_certificates(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_databases(self, name: str = None, threshold: float = None) -> Dict[str, Any]: @@ -234,7 +226,6 @@ def get_queue_databases(self, name: str = None, threshold: float = None) -> Dict api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_deletes(self, threshold: float = None) -> Dict[str, Any]: @@ -263,7 +254,6 @@ def get_queue_deletes(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_failed_jobs(self, name: Name, threshold: float = None) -> Dict[str, Any]: @@ -299,7 +289,6 @@ def get_failed_jobs(self, name: Name, threshold: float = None) -> Dict[str, Any] api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_functions(self, threshold: float = None) -> Dict[str, Any]: @@ -328,7 +317,6 @@ def get_queue_functions(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_logs(self, threshold: float = None) -> Dict[str, Any]: @@ -357,7 +345,6 @@ def get_queue_logs(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_mails(self, threshold: float = None) -> Dict[str, Any]: @@ -386,7 +373,6 @@ def get_queue_mails(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_messaging(self, threshold: float = None) -> Dict[str, Any]: @@ -415,7 +401,6 @@ def get_queue_messaging(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_migrations(self, threshold: float = None) -> Dict[str, Any]: @@ -444,7 +429,6 @@ def get_queue_migrations(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_stats_resources(self, threshold: float = None) -> Dict[str, Any]: @@ -473,7 +457,6 @@ def get_queue_stats_resources(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_usage(self, threshold: float = None) -> Dict[str, Any]: @@ -502,36 +485,6 @@ def get_queue_usage(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', - }, api_params) - - def get_queue_stats_usage_dump(self, threshold: float = None) -> Dict[str, Any]: - """ - Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server. - - Parameters - ---------- - threshold : float - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/health/queue/stats-usage-dump' - api_params = {} - - api_params['threshold'] = threshold - - return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_webhooks(self, threshold: float = None) -> Dict[str, Any]: @@ -560,7 +513,6 @@ def get_queue_webhooks(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_storage(self) -> Dict[str, Any]: @@ -582,7 +534,6 @@ def get_storage(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_storage_local(self) -> Dict[str, Any]: @@ -604,7 +555,6 @@ def get_storage_local(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_time(self) -> Dict[str, Any]: @@ -626,5 +576,4 @@ def get_time(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/locale.py b/appwrite/services/locale.py index 67f7a9c..c34ddee 100644 --- a/appwrite/services/locale.py +++ b/appwrite/services/locale.py @@ -28,7 +28,6 @@ def get(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_codes(self) -> Dict[str, Any]: @@ -50,7 +49,6 @@ def list_codes(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_continents(self) -> Dict[str, Any]: @@ -72,7 +70,6 @@ def list_continents(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_countries(self) -> Dict[str, Any]: @@ -94,7 +91,6 @@ def list_countries(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_countries_eu(self) -> Dict[str, Any]: @@ -116,7 +112,6 @@ def list_countries_eu(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_countries_phones(self) -> Dict[str, Any]: @@ -138,7 +133,6 @@ def list_countries_phones(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_currencies(self) -> Dict[str, Any]: @@ -160,7 +154,6 @@ def list_currencies(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_languages(self) -> Dict[str, Any]: @@ -182,5 +175,4 @@ def list_languages(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index 684c08d..639a820 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -38,7 +38,6 @@ def list_messages(self, queries: List[str] = None, search: str = None) -> Dict[s api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_email(self, message_id: str, subject: str, content: str, topics: List[str] = None, users: List[str] = None, targets: List[str] = None, cc: List[str] = None, bcc: List[str] = None, attachments: List[str] = None, draft: bool = None, html: bool = None, scheduled_at: str = None) -> Dict[str, Any]: @@ -485,7 +484,6 @@ def get_message(self, message_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete(self, message_id: str) -> Dict[str, Any]: @@ -552,7 +550,6 @@ def list_message_logs(self, message_id: str, queries: List[str] = None) -> Dict[ api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_targets(self, message_id: str, queries: List[str] = None) -> Dict[str, Any]: @@ -587,7 +584,6 @@ def list_targets(self, message_id: str, queries: List[str] = None) -> Dict[str, api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_providers(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: @@ -619,7 +615,6 @@ def list_providers(self, queries: List[str] = None, search: str = None) -> Dict[ api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_apns_provider(self, provider_id: str, name: str, auth_key: str = None, auth_key_id: str = None, team_id: str = None, bundle_id: str = None, sandbox: bool = None, enabled: bool = None) -> Dict[str, Any]: @@ -1709,7 +1704,6 @@ def get_provider(self, provider_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_provider(self, provider_id: str) -> Dict[str, Any]: @@ -1776,7 +1770,6 @@ def list_provider_logs(self, provider_id: str, queries: List[str] = None) -> Dic api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None) -> Dict[str, Any]: @@ -1811,7 +1804,6 @@ def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None) -> api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_topics(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: @@ -1843,7 +1835,6 @@ def list_topics(self, queries: List[str] = None, search: str = None) -> Dict[str api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_topic(self, topic_id: str, name: str, subscribe: List[str] = None) -> Dict[str, Any]: @@ -1917,7 +1908,6 @@ def get_topic(self, topic_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_topic(self, topic_id: str, name: str = None, subscribe: List[str] = None) -> Dict[str, Any]: @@ -2023,7 +2013,6 @@ def list_topic_logs(self, topic_id: str, queries: List[str] = None) -> Dict[str, api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_subscribers(self, topic_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: @@ -2061,7 +2050,6 @@ def list_subscribers(self, topic_id: str, queries: List[str] = None, search: str api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str) -> Dict[str, Any]: @@ -2144,7 +2132,6 @@ def get_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any]: diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index cf43652..610e11e 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -40,7 +40,6 @@ def list_buckets(self, queries: List[str] = None, search: str = None) -> Dict[st api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_bucket(self, bucket_id: str, name: str, permissions: List[str] = None, file_security: bool = None, enabled: bool = None, maximum_file_size: float = None, allowed_file_extensions: List[str] = None, compression: Compression = None, encryption: bool = None, antivirus: bool = None) -> Dict[str, Any]: @@ -134,7 +133,6 @@ def get_bucket(self, bucket_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_bucket(self, bucket_id: str, name: str, permissions: List[str] = None, file_security: bool = None, enabled: bool = None, maximum_file_size: float = None, allowed_file_extensions: List[str] = None, compression: Compression = None, encryption: bool = None, antivirus: bool = None) -> Dict[str, Any]: @@ -266,7 +264,6 @@ def list_files(self, bucket_id: str, queries: List[str] = None, search: str = No api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions: List[str] = None, on_progress = None) -> Dict[str, Any]: @@ -366,7 +363,6 @@ def get_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_file(self, bucket_id: str, file_id: str, name: str = None, permissions: List[str] = None) -> Dict[str, Any]: @@ -486,7 +482,6 @@ def get_file_download(self, bucket_id: str, file_id: str) -> bytes: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, height: float = None, gravity: ImageGravity = None, quality: float = None, border_width: float = None, border_color: str = None, border_radius: float = None, opacity: float = None, rotation: float = None, background: str = None, output: ImageFormat = None) -> bytes: @@ -557,7 +552,6 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he api_params['output'] = output return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_file_view(self, bucket_id: str, file_id: str) -> bytes: @@ -595,5 +589,4 @@ def get_file_view(self, bucket_id: str, file_id: str) -> bytes: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index 2a106a5..778cd07 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -36,7 +36,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create(self, team_id: str, name: str, roles: List[str] = None) -> Dict[str, Any]: @@ -109,7 +108,6 @@ def get(self, team_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_name(self, team_id: str, name: str) -> Dict[str, Any]: @@ -217,7 +215,6 @@ def list_memberships(self, team_id: str, queries: List[str] = None, search: str api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_membership(self, team_id: str, roles: List[str], email: str = None, user_id: str = None, phone: str = None, url: str = None, name: str = None) -> Dict[str, Any]: @@ -315,7 +312,6 @@ def get_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_membership(self, team_id: str, membership_id: str, roles: List[str]) -> Dict[str, Any]: @@ -483,7 +479,6 @@ def get_prefs(self, team_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_prefs(self, team_id: str, prefs: dict) -> Dict[str, Any]: diff --git a/appwrite/services/users.py b/appwrite/services/users.py index f4497c1..532c69f 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -39,7 +39,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create(self, user_id: str, email: str = None, phone: str = None, password: str = None, name: str = None) -> Dict[str, Any]: @@ -209,7 +208,6 @@ def list_identities(self, queries: List[str] = None, search: str = None) -> Dict api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_identity(self, identity_id: str) -> Dict[str, Any]: @@ -559,7 +557,6 @@ def get(self, user_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete(self, user_id: str) -> Dict[str, Any]: @@ -742,7 +739,6 @@ def list_logs(self, user_id: str, queries: List[str] = None) -> Dict[str, Any]: api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_memberships(self, user_id: str) -> Dict[str, Any]: @@ -774,7 +770,6 @@ def list_memberships(self, user_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_mfa(self, user_id: str, mfa: bool) -> Dict[str, Any]: @@ -882,7 +877,6 @@ def list_mfa_factors(self, user_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: @@ -914,7 +908,6 @@ def get_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: @@ -1124,7 +1117,6 @@ def get_prefs(self, user_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_prefs(self, user_id: str, prefs: dict) -> Dict[str, Any]: @@ -1194,7 +1186,6 @@ def list_sessions(self, user_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_session(self, user_id: str) -> Dict[str, Any]: @@ -1371,7 +1362,6 @@ def list_targets(self, user_id: str, queries: List[str] = None) -> Dict[str, Any api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_target(self, user_id: str, target_id: str, provider_type: MessagingProviderType, identifier: str, provider_id: str = None, name: str = None) -> Dict[str, Any]: @@ -1465,7 +1455,6 @@ def get_target(self, user_id: str, target_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_target(self, user_id: str, target_id: str, identifier: str = None, provider_id: str = None, name: str = None) -> Dict[str, Any]: diff --git a/docs/examples/health/get-queue-stats-usage-dump.md b/docs/examples/health/get-queue-stats-usage-dump.md deleted file mode 100644 index c58059e..0000000 --- a/docs/examples/health/get-queue-stats-usage-dump.md +++ /dev/null @@ -1,13 +0,0 @@ -from appwrite.client import Client -from appwrite.services.health import Health - -client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('') # Your project ID -client.set_key('') # Your secret API key - -health = Health(client) - -result = health.get_queue_stats_usage_dump( - threshold = None # optional -) diff --git a/setup.py b/setup.py index 6ffadf7..1b9067b 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '9.0.3', + version = '9.0.4', license='BSD-3-Clause', description = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API', long_description = long_description, @@ -23,7 +23,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/9.0.3.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/9.0.4.tar.gz', install_requires=[ 'requests', ], From 0a2355c3e9bc73830a1d262bbc7b1315e4aaff13 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 17 Apr 2025 20:37:44 +0100 Subject: [PATCH 2/2] chore: major version bump --- appwrite/client.py | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/appwrite/client.py b/appwrite/client.py index ce46fde..2548979 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,11 +14,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/9.0.4 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/10.0.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': '9.0.4', + 'x-sdk-version': '10.0.0', 'X-Appwrite-Response-Format' : '1.6.0', } diff --git a/setup.py b/setup.py index 1b9067b..2534ed2 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '9.0.4', + version = '10.0.0', license='BSD-3-Clause', description = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API', long_description = long_description, @@ -23,7 +23,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/9.0.4.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/10.0.0.tar.gz', install_requires=[ 'requests', ],