Skip to content

Commit 2415efa

Browse files
Merge pull request #107 from appwrite/dev
fix: remove content-type from GET requests
2 parents 8ae2126 + 0a2355c commit 2415efa

File tree

16 files changed

+10
-152
lines changed

16 files changed

+10
-152
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Appwrite Python SDK
22

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

appwrite/client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ def __init__(self):
1414
self._endpoint = 'https://cloud.appwrite.io/v1'
1515
self._global_headers = {
1616
'content-type': '',
17-
'user-agent' : f'AppwritePythonSDK/9.0.3 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
17+
'user-agent' : f'AppwritePythonSDK/10.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
1818
'x-sdk-name': 'Python',
1919
'x-sdk-platform': 'server',
2020
'x-sdk-language': 'python',
21-
'x-sdk-version': '9.0.3',
21+
'x-sdk-version': '10.0.0',
2222
'X-Appwrite-Response-Format' : '1.6.0',
2323
}
2424

@@ -27,6 +27,9 @@ def set_self_signed(self, status=True):
2727
return self
2828

2929
def set_endpoint(self, endpoint):
30+
if not endpoint.startswith('http://') and not endpoint.startswith('https://'):
31+
raise AppwriteException('Invalid endpoint URL: ' + endpoint)
32+
3033
self._endpoint = endpoint
3134
return self
3235

appwrite/enums/name.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class Name(Enum):
88
V1_FUNCTIONS = "v1-functions"
99
V1_STATS_RESOURCES = "v1-stats-resources"
1010
V1_STATS_USAGE = "v1-stats-usage"
11-
V1_STATS_USAGE_DUMP = "v1-stats-usage-dump"
1211
V1_WEBHOOKS = "v1-webhooks"
1312
V1_CERTIFICATES = "v1-certificates"
1413
V1_BUILDS = "v1-builds"

appwrite/enums/o_auth_provider.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class OAuthProvider(Enum):
1515
DROPBOX = "dropbox"
1616
ETSY = "etsy"
1717
FACEBOOK = "facebook"
18+
FIGMA = "figma"
1819
GITHUB = "github"
1920
GITLAB = "gitlab"
2021
GOOGLE = "google"

appwrite/services/account.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def get(self) -> Dict[str, Any]:
2929
api_params = {}
3030

3131
return self.client.call('get', api_path, {
32-
'content-type': 'application/json',
3332
}, api_params)
3433

3534
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]:
145144
api_params['queries'] = queries
146145

147146
return self.client.call('get', api_path, {
148-
'content-type': 'application/json',
149147
}, api_params)
150148

151149
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]:
228226
api_params['queries'] = queries
229227

230228
return self.client.call('get', api_path, {
231-
'content-type': 'application/json',
232229
}, api_params)
233230

234231
def update_mfa(self, mfa: bool) -> Dict[str, Any]:
@@ -454,7 +451,6 @@ def list_mfa_factors(self) -> Dict[str, Any]:
454451
api_params = {}
455452

456453
return self.client.call('get', api_path, {
457-
'content-type': 'application/json',
458454
}, api_params)
459455

460456
def get_mfa_recovery_codes(self) -> Dict[str, Any]:
@@ -476,7 +472,6 @@ def get_mfa_recovery_codes(self) -> Dict[str, Any]:
476472
api_params = {}
477473

478474
return self.client.call('get', api_path, {
479-
'content-type': 'application/json',
480475
}, api_params)
481476

482477
def create_mfa_recovery_codes(self) -> Dict[str, Any]:
@@ -647,7 +642,6 @@ def get_prefs(self) -> Dict[str, Any]:
647642
api_params = {}
648643

649644
return self.client.call('get', api_path, {
650-
'content-type': 'application/json',
651645
}, api_params)
652646

653647
def update_prefs(self, prefs: dict) -> Dict[str, Any]:
@@ -785,7 +779,6 @@ def list_sessions(self) -> Dict[str, Any]:
785779
api_params = {}
786780

787781
return self.client.call('get', api_path, {
788-
'content-type': 'application/json',
789782
}, api_params)
790783

791784
def delete_sessions(self) -> Dict[str, Any]:
@@ -1015,7 +1008,6 @@ def get_session(self, session_id: str) -> Dict[str, Any]:
10151008

10161009

10171010
return self.client.call('get', api_path, {
1018-
'content-type': 'application/json',
10191011
}, api_params)
10201012

10211013
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
12051197
Parameters
12061198
----------
12071199
provider : OAuthProvider
1208-
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.
1200+
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.
12091201
success : str
12101202
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.
12111203
failure : str
@@ -1236,7 +1228,6 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, fai
12361228
api_params['scopes'] = scopes
12371229

12381230
return self.client.call('get', api_path, {
1239-
'content-type': 'application/json',
12401231
}, api_params, response_type='location')
12411232

12421233
def create_phone_token(self, user_id: str, phone: str) -> Dict[str, Any]:

appwrite/services/avatars.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def get_browser(self, code: Browser, width: float = None, height: float = None,
5050
api_params['quality'] = quality
5151

5252
return self.client.call('get', api_path, {
53-
'content-type': 'application/json',
5453
}, api_params)
5554

5655
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 =
9493
api_params['quality'] = quality
9594

9695
return self.client.call('get', api_path, {
97-
'content-type': 'application/json',
9896
}, api_params)
9997

10098
def get_favicon(self, url: str) -> bytes:
@@ -128,7 +126,6 @@ def get_favicon(self, url: str) -> bytes:
128126
api_params['url'] = url
129127

130128
return self.client.call('get', api_path, {
131-
'content-type': 'application/json',
132129
}, api_params)
133130

134131
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
172169
api_params['quality'] = quality
173170

174171
return self.client.call('get', api_path, {
175-
'content-type': 'application/json',
176172
}, api_params)
177173

178174
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
214210
api_params['height'] = height
215211

216212
return self.client.call('get', api_path, {
217-
'content-type': 'application/json',
218213
}, api_params)
219214

220215
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
257252
api_params['background'] = background
258253

259254
return self.client.call('get', api_path, {
260-
'content-type': 'application/json',
261255
}, api_params)
262256

263257
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:
299293
api_params['download'] = download
300294

301295
return self.client.call('get', api_path, {
302-
'content-type': 'application/json',
303296
}, api_params)

appwrite/services/databases.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]:
3939
api_params['search'] = search
4040

4141
return self.client.call('get', api_path, {
42-
'content-type': 'application/json',
4342
}, api_params)
4443

4544
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]:
113112

114113

115114
return self.client.call('get', api_path, {
116-
'content-type': 'application/json',
117115
}, api_params)
118116

119117
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:
224222
api_params['search'] = search
225223

226224
return self.client.call('get', api_path, {
227-
'content-type': 'application/json',
228225
}, api_params)
229226

230227
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]
315312

316313

317314
return self.client.call('get', api_path, {
318-
'content-type': 'application/json',
319315
}, api_params)
320316

321317
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
447443
api_params['queries'] = queries
448444

449445
return self.client.call('get', api_path, {
450-
'content-type': 'application/json',
451446
}, api_params)
452447

453448
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[
16251620

16261621

16271622
return self.client.call('get', api_path, {
1628-
'content-type': 'application/json',
16291623
}, api_params)
16301624

16311625
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
17611755
api_params['queries'] = queries
17621756

17631757
return self.client.call('get', api_path, {
1764-
'content-type': 'application/json',
17651758
}, api_params)
17661759

17671760
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
18621855
api_params['queries'] = queries
18631856

18641857
return self.client.call('get', api_path, {
1865-
'content-type': 'application/json',
18661858
}, api_params)
18671859

18681860
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]
19971989
api_params['queries'] = queries
19981990

19991991
return self.client.call('get', api_path, {
2000-
'content-type': 'application/json',
20011992
}, api_params)
20021993

20031994
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,
21012092

21022093

21032094
return self.client.call('get', api_path, {
2104-
'content-type': 'application/json',
21052095
}, api_params)
21062096

21072097
def delete_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, Any]:

appwrite/services/functions.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]:
3939
api_params['search'] = search
4040

4141
return self.client.call('get', api_path, {
42-
'content-type': 'application/json',
4342
}, api_params)
4443

4544
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]:
162161
api_params = {}
163162

164163
return self.client.call('get', api_path, {
165-
'content-type': 'application/json',
166164
}, api_params)
167165

168166
def list_specifications(self) -> Dict[str, Any]:
@@ -185,7 +183,6 @@ def list_specifications(self) -> Dict[str, Any]:
185183
api_params = {}
186184

187185
return self.client.call('get', api_path, {
188-
'content-type': 'application/json',
189186
}, api_params)
190187

191188
def get(self, function_id: str) -> Dict[str, Any]:
@@ -217,7 +214,6 @@ def get(self, function_id: str) -> Dict[str, Any]:
217214

218215

219216
return self.client.call('get', api_path, {
220-
'content-type': 'application/json',
221217
}, api_params)
222218

223219
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:
373369
api_params['search'] = search
374370

375371
return self.client.call('get', api_path, {
376-
'content-type': 'application/json',
377372
}, api_params)
378373

379374
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]
472467

473468

474469
return self.client.call('get', api_path, {
475-
'content-type': 'application/json',
476470
}, api_params)
477471

478472
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
665659

666660

667661
return self.client.call('get', api_path, {
668-
'content-type': 'application/json',
669662
}, api_params)
670663

671664
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
703696
api_params['search'] = search
704697

705698
return self.client.call('get', api_path, {
706-
'content-type': 'application/json',
707699
}, api_params)
708700

709701
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]:
791783

792784

793785
return self.client.call('get', api_path, {
794-
'content-type': 'application/json',
795786
}, api_params)
796787

797788
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]:
862853

863854

864855
return self.client.call('get', api_path, {
865-
'content-type': 'application/json',
866856
}, api_params)
867857

868858
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]:
944934

945935

946936
return self.client.call('get', api_path, {
947-
'content-type': 'application/json',
948937
}, api_params)
949938

950939
def update_variable(self, function_id: str, variable_id: str, key: str, value: str = None) -> Dict[str, Any]:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy