Skip to content

fix: remove content-type from GET requests #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 17, 2025
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
7 changes: 5 additions & 2 deletions appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/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.3',
'x-sdk-version': '10.0.0',
'X-Appwrite-Response-Format' : '1.6.0',
}

Expand All @@ -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

Expand Down
1 change: 0 additions & 1 deletion appwrite/enums/name.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions appwrite/enums/o_auth_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class OAuthProvider(Enum):
DROPBOX = "dropbox"
ETSY = "etsy"
FACEBOOK = "facebook"
FIGMA = "figma"
GITHUB = "github"
GITLAB = "gitlab"
GOOGLE = "google"
Expand Down
11 changes: 1 addition & 10 deletions appwrite/services/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand All @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]:
Expand Down
7 changes: 0 additions & 7 deletions appwrite/services/avatars.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
10 changes: 0 additions & 10 deletions appwrite/services/databases.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down
11 changes: 0 additions & 11 deletions appwrite/services/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand All @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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]:
Expand Down
Loading