Skip to content

Commit 4746e2d

Browse files
Merge pull request #69 from appwrite/dev
feat: release 1.4.x
2 parents b0b4128 + 6e858aa commit 4746e2d

26 files changed

+639
-349
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
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.3.2-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.4.0-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)
88

9-
**This SDK is compatible with Appwrite server version 1.3.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).**
9+
**This SDK is compatible with Appwrite server version 1.4.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).**
1010

1111
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)
1212

appwrite/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ def __init__(self):
1111
self._endpoint = 'https://HOSTNAME/v1'
1212
self._global_headers = {
1313
'content-type': '',
14-
'user-agent' : 'AppwritePythonSDK/2.0.2 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
14+
'user-agent' : 'AppwritePythonSDK/3.0.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
1515
'x-sdk-name': 'Python',
1616
'x-sdk-platform': 'server',
1717
'x-sdk-language': 'python',
18-
'x-sdk-version': '2.0.2',
19-
'X-Appwrite-Response-Format' : '1.0.0',
18+
'x-sdk-version': '3.0.0',
19+
'X-Appwrite-Response-Format' : '1.4.0',
2020
}
2121

2222
def set_self_signed(self, status=True):

appwrite/services/account.py

Lines changed: 69 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ def get(self):
1010
"""Get Account"""
1111

1212

13-
path = '/account'
13+
api_path = '/account'
1414
params = {}
1515

16-
return self.client.call('get', path, {
16+
return self.client.call('get', api_path, {
1717
'content-type': 'application/json',
1818
}, params)
1919

2020
def update_email(self, email, password):
2121
"""Update Email"""
2222

2323

24-
path = '/account/email'
24+
api_path = '/account/email'
2525
params = {}
2626
if email is None:
2727
raise AppwriteException('Missing required parameter: "email"')
@@ -33,44 +33,73 @@ def update_email(self, email, password):
3333
params['email'] = email
3434
params['password'] = password
3535

36-
return self.client.call('patch', path, {
36+
return self.client.call('patch', api_path, {
37+
'content-type': 'application/json',
38+
}, params)
39+
40+
def list_identities(self, queries = None):
41+
"""List Identities"""
42+
43+
44+
api_path = '/account/identities'
45+
params = {}
46+
47+
params['queries'] = queries
48+
49+
return self.client.call('get', api_path, {
50+
'content-type': 'application/json',
51+
}, params)
52+
53+
def delete_identity(self, identity_id):
54+
"""Delete Identity"""
55+
56+
57+
api_path = '/account/identities/{identityId}'
58+
params = {}
59+
if identity_id is None:
60+
raise AppwriteException('Missing required parameter: "identity_id"')
61+
62+
path = path.replace('{identityId}', identity_id)
63+
64+
65+
return self.client.call('delete', api_path, {
3766
'content-type': 'application/json',
3867
}, params)
3968

4069
def list_logs(self, queries = None):
4170
"""List Logs"""
4271

4372

44-
path = '/account/logs'
73+
api_path = '/account/logs'
4574
params = {}
4675

4776
params['queries'] = queries
4877

49-
return self.client.call('get', path, {
78+
return self.client.call('get', api_path, {
5079
'content-type': 'application/json',
5180
}, params)
5281

5382
def update_name(self, name):
5483
"""Update Name"""
5584

5685

57-
path = '/account/name'
86+
api_path = '/account/name'
5887
params = {}
5988
if name is None:
6089
raise AppwriteException('Missing required parameter: "name"')
6190

6291

6392
params['name'] = name
6493

65-
return self.client.call('patch', path, {
94+
return self.client.call('patch', api_path, {
6695
'content-type': 'application/json',
6796
}, params)
6897

6998
def update_password(self, password, old_password = None):
7099
"""Update Password"""
71100

72101

73-
path = '/account/password'
102+
api_path = '/account/password'
74103
params = {}
75104
if password is None:
76105
raise AppwriteException('Missing required parameter: "password"')
@@ -79,15 +108,15 @@ def update_password(self, password, old_password = None):
79108
params['password'] = password
80109
params['oldPassword'] = old_password
81110

82-
return self.client.call('patch', path, {
111+
return self.client.call('patch', api_path, {
83112
'content-type': 'application/json',
84113
}, params)
85114

86115
def update_phone(self, phone, password):
87116
"""Update Phone"""
88117

89118

90-
path = '/account/phone'
119+
api_path = '/account/phone'
91120
params = {}
92121
if phone is None:
93122
raise AppwriteException('Missing required parameter: "phone"')
@@ -99,42 +128,42 @@ def update_phone(self, phone, password):
99128
params['phone'] = phone
100129
params['password'] = password
101130

102-
return self.client.call('patch', path, {
131+
return self.client.call('patch', api_path, {
103132
'content-type': 'application/json',
104133
}, params)
105134

106135
def get_prefs(self):
107136
"""Get Account Preferences"""
108137

109138

110-
path = '/account/prefs'
139+
api_path = '/account/prefs'
111140
params = {}
112141

113-
return self.client.call('get', path, {
142+
return self.client.call('get', api_path, {
114143
'content-type': 'application/json',
115144
}, params)
116145

117146
def update_prefs(self, prefs):
118147
"""Update Preferences"""
119148

120149

121-
path = '/account/prefs'
150+
api_path = '/account/prefs'
122151
params = {}
123152
if prefs is None:
124153
raise AppwriteException('Missing required parameter: "prefs"')
125154

126155

127156
params['prefs'] = prefs
128157

129-
return self.client.call('patch', path, {
158+
return self.client.call('patch', api_path, {
130159
'content-type': 'application/json',
131160
}, params)
132161

133162
def create_recovery(self, email, url):
134163
"""Create Password Recovery"""
135164

136165

137-
path = '/account/recovery'
166+
api_path = '/account/recovery'
138167
params = {}
139168
if email is None:
140169
raise AppwriteException('Missing required parameter: "email"')
@@ -146,15 +175,15 @@ def create_recovery(self, email, url):
146175
params['email'] = email
147176
params['url'] = url
148177

149-
return self.client.call('post', path, {
178+
return self.client.call('post', api_path, {
150179
'content-type': 'application/json',
151180
}, params)
152181

153182
def update_recovery(self, user_id, secret, password, password_again):
154183
"""Create Password Recovery (confirmation)"""
155184

156185

157-
path = '/account/recovery'
186+
api_path = '/account/recovery'
158187
params = {}
159188
if user_id is None:
160189
raise AppwriteException('Missing required parameter: "user_id"')
@@ -174,112 +203,112 @@ def update_recovery(self, user_id, secret, password, password_again):
174203
params['password'] = password
175204
params['passwordAgain'] = password_again
176205

177-
return self.client.call('put', path, {
206+
return self.client.call('put', api_path, {
178207
'content-type': 'application/json',
179208
}, params)
180209

181210
def list_sessions(self):
182211
"""List Sessions"""
183212

184213

185-
path = '/account/sessions'
214+
api_path = '/account/sessions'
186215
params = {}
187216

188-
return self.client.call('get', path, {
217+
return self.client.call('get', api_path, {
189218
'content-type': 'application/json',
190219
}, params)
191220

192221
def delete_sessions(self):
193222
"""Delete Sessions"""
194223

195224

196-
path = '/account/sessions'
225+
api_path = '/account/sessions'
197226
params = {}
198227

199-
return self.client.call('delete', path, {
228+
return self.client.call('delete', api_path, {
200229
'content-type': 'application/json',
201230
}, params)
202231

203232
def get_session(self, session_id):
204233
"""Get Session"""
205234

206235

207-
path = '/account/sessions/{sessionId}'
236+
api_path = '/account/sessions/{sessionId}'
208237
params = {}
209238
if session_id is None:
210239
raise AppwriteException('Missing required parameter: "session_id"')
211240

212241
path = path.replace('{sessionId}', session_id)
213242

214243

215-
return self.client.call('get', path, {
244+
return self.client.call('get', api_path, {
216245
'content-type': 'application/json',
217246
}, params)
218247

219248
def update_session(self, session_id):
220249
"""Update OAuth Session (Refresh Tokens)"""
221250

222251

223-
path = '/account/sessions/{sessionId}'
252+
api_path = '/account/sessions/{sessionId}'
224253
params = {}
225254
if session_id is None:
226255
raise AppwriteException('Missing required parameter: "session_id"')
227256

228257
path = path.replace('{sessionId}', session_id)
229258

230259

231-
return self.client.call('patch', path, {
260+
return self.client.call('patch', api_path, {
232261
'content-type': 'application/json',
233262
}, params)
234263

235264
def delete_session(self, session_id):
236265
"""Delete Session"""
237266

238267

239-
path = '/account/sessions/{sessionId}'
268+
api_path = '/account/sessions/{sessionId}'
240269
params = {}
241270
if session_id is None:
242271
raise AppwriteException('Missing required parameter: "session_id"')
243272

244273
path = path.replace('{sessionId}', session_id)
245274

246275

247-
return self.client.call('delete', path, {
276+
return self.client.call('delete', api_path, {
248277
'content-type': 'application/json',
249278
}, params)
250279

251280
def update_status(self):
252281
"""Update Status"""
253282

254283

255-
path = '/account/status'
284+
api_path = '/account/status'
256285
params = {}
257286

258-
return self.client.call('patch', path, {
287+
return self.client.call('patch', api_path, {
259288
'content-type': 'application/json',
260289
}, params)
261290

262291
def create_verification(self, url):
263292
"""Create Email Verification"""
264293

265294

266-
path = '/account/verification'
295+
api_path = '/account/verification'
267296
params = {}
268297
if url is None:
269298
raise AppwriteException('Missing required parameter: "url"')
270299

271300

272301
params['url'] = url
273302

274-
return self.client.call('post', path, {
303+
return self.client.call('post', api_path, {
275304
'content-type': 'application/json',
276305
}, params)
277306

278307
def update_verification(self, user_id, secret):
279308
"""Create Email Verification (confirmation)"""
280309

281310

282-
path = '/account/verification'
311+
api_path = '/account/verification'
283312
params = {}
284313
if user_id is None:
285314
raise AppwriteException('Missing required parameter: "user_id"')
@@ -291,26 +320,26 @@ def update_verification(self, user_id, secret):
291320
params['userId'] = user_id
292321
params['secret'] = secret
293322

294-
return self.client.call('put', path, {
323+
return self.client.call('put', api_path, {
295324
'content-type': 'application/json',
296325
}, params)
297326

298327
def create_phone_verification(self):
299328
"""Create Phone Verification"""
300329

301330

302-
path = '/account/verification/phone'
331+
api_path = '/account/verification/phone'
303332
params = {}
304333

305-
return self.client.call('post', path, {
334+
return self.client.call('post', api_path, {
306335
'content-type': 'application/json',
307336
}, params)
308337

309338
def update_phone_verification(self, user_id, secret):
310339
"""Create Phone Verification (confirmation)"""
311340

312341

313-
path = '/account/verification/phone'
342+
api_path = '/account/verification/phone'
314343
params = {}
315344
if user_id is None:
316345
raise AppwriteException('Missing required parameter: "user_id"')
@@ -322,6 +351,6 @@ def update_phone_verification(self, user_id, secret):
322351
params['userId'] = user_id
323352
params['secret'] = secret
324353

325-
return self.client.call('put', path, {
354+
return self.client.call('put', api_path, {
326355
'content-type': 'application/json',
327356
}, params)

0 commit comments

Comments
 (0)