Skip to content

Commit f119a57

Browse files
committed
fix none issue
1 parent fcd9e6e commit f119a57

File tree

15 files changed

+1309
-656
lines changed

15 files changed

+1309
-656
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 13.6.1
4+
5+
* Fix passing of `None` to nullable parameters
6+
37
## 13.6.0
48

59
* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance

appwrite/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ def __init__(self):
1515
self._endpoint = 'https://cloud.appwrite.io/v1'
1616
self._global_headers = {
1717
'content-type': '',
18-
'user-agent' : f'AppwritePythonSDK/13.6.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
18+
'user-agent' : f'AppwritePythonSDK/13.6.1 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
1919
'x-sdk-name': 'Python',
2020
'x-sdk-platform': 'server',
2121
'x-sdk-language': 'python',
22-
'x-sdk-version': '13.6.0',
22+
'x-sdk-version': '13.6.1',
2323
'X-Appwrite-Response-Format' : '1.8.0',
2424
}
2525

appwrite/services/account.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def create(self, user_id: str, email: str, password: str, name: Optional[str] =
7373
api_params['userId'] = user_id
7474
api_params['email'] = email
7575
api_params['password'] = password
76-
api_params['name'] = name
76+
if name is not None:
77+
api_params['name'] = name
7778

7879
return self.client.call('post', api_path, {
7980
'content-type': 'application/json',
@@ -144,8 +145,10 @@ def list_identities(self, queries: Optional[List[str]] = None, total: Optional[b
144145
api_path = '/account/identities'
145146
api_params = {}
146147

147-
api_params['queries'] = queries
148-
api_params['total'] = total
148+
if queries is not None:
149+
api_params['queries'] = queries
150+
if total is not None:
151+
api_params['total'] = total
149152

150153
return self.client.call('get', api_path, {
151154
}, api_params)
@@ -229,8 +232,10 @@ def list_logs(self, queries: Optional[List[str]] = None, total: Optional[bool] =
229232
api_path = '/account/logs'
230233
api_params = {}
231234

232-
api_params['queries'] = queries
233-
api_params['total'] = total
235+
if queries is not None:
236+
api_params['queries'] = queries
237+
if total is not None:
238+
api_params['total'] = total
234239

235240
return self.client.call('get', api_path, {
236241
}, api_params)
@@ -586,7 +591,8 @@ def update_password(self, password: str, old_password: Optional[str] = None) ->
586591

587592

588593
api_params['password'] = password
589-
api_params['oldPassword'] = old_password
594+
if old_password is not None:
595+
api_params['oldPassword'] = old_password
590596

591597
return self.client.call('patch', api_path, {
592598
'content-type': 'application/json',
@@ -1147,7 +1153,8 @@ def create_email_token(self, user_id: str, email: str, phrase: Optional[bool] =
11471153

11481154
api_params['userId'] = user_id
11491155
api_params['email'] = email
1150-
api_params['phrase'] = phrase
1156+
if phrase is not None:
1157+
api_params['phrase'] = phrase
11511158

11521159
return self.client.call('post', api_path, {
11531160
'content-type': 'application/json',
@@ -1193,8 +1200,10 @@ def create_magic_url_token(self, user_id: str, email: str, url: Optional[str] =
11931200

11941201
api_params['userId'] = user_id
11951202
api_params['email'] = email
1196-
api_params['url'] = url
1197-
api_params['phrase'] = phrase
1203+
if url is not None:
1204+
api_params['url'] = url
1205+
if phrase is not None:
1206+
api_params['phrase'] = phrase
11981207

11991208
return self.client.call('post', api_path, {
12001209
'content-type': 'application/json',
@@ -1237,9 +1246,12 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: Optional[str] =
12371246

12381247
api_path = api_path.replace('{provider}', provider)
12391248

1240-
api_params['success'] = success
1241-
api_params['failure'] = failure
1242-
api_params['scopes'] = scopes
1249+
if success is not None:
1250+
api_params['success'] = success
1251+
if failure is not None:
1252+
api_params['failure'] = failure
1253+
if scopes is not None:
1254+
api_params['scopes'] = scopes
12431255

12441256
return self.client.call('get', api_path, {
12451257
}, api_params, response_type='location')

appwrite/services/avatars.py

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ def get_browser(self, code: Browser, width: Optional[float] = None, height: Opti
4646

4747
api_path = api_path.replace('{code}', code)
4848

49-
api_params['width'] = width
50-
api_params['height'] = height
51-
api_params['quality'] = quality
49+
if width is not None:
50+
api_params['width'] = width
51+
if height is not None:
52+
api_params['height'] = height
53+
if quality is not None:
54+
api_params['quality'] = quality
5255

5356
return self.client.call('get', api_path, {
5457
}, api_params)
@@ -89,9 +92,12 @@ def get_credit_card(self, code: CreditCard, width: Optional[float] = None, heigh
8992

9093
api_path = api_path.replace('{code}', code)
9194

92-
api_params['width'] = width
93-
api_params['height'] = height
94-
api_params['quality'] = quality
95+
if width is not None:
96+
api_params['width'] = width
97+
if height is not None:
98+
api_params['height'] = height
99+
if quality is not None:
100+
api_params['quality'] = quality
95101

96102
return self.client.call('get', api_path, {
97103
}, api_params)
@@ -165,9 +171,12 @@ def get_flag(self, code: Flag, width: Optional[float] = None, height: Optional[f
165171

166172
api_path = api_path.replace('{code}', code)
167173

168-
api_params['width'] = width
169-
api_params['height'] = height
170-
api_params['quality'] = quality
174+
if width is not None:
175+
api_params['width'] = width
176+
if height is not None:
177+
api_params['height'] = height
178+
if quality is not None:
179+
api_params['quality'] = quality
171180

172181
return self.client.call('get', api_path, {
173182
}, api_params)
@@ -207,8 +216,10 @@ def get_image(self, url: str, width: Optional[float] = None, height: Optional[fl
207216

208217

209218
api_params['url'] = url
210-
api_params['width'] = width
211-
api_params['height'] = height
219+
if width is not None:
220+
api_params['width'] = width
221+
if height is not None:
222+
api_params['height'] = height
212223

213224
return self.client.call('get', api_path, {
214225
}, api_params)
@@ -247,10 +258,14 @@ def get_initials(self, name: Optional[str] = None, width: Optional[float] = None
247258
api_path = '/avatars/initials'
248259
api_params = {}
249260

250-
api_params['name'] = name
251-
api_params['width'] = width
252-
api_params['height'] = height
253-
api_params['background'] = background
261+
if name is not None:
262+
api_params['name'] = name
263+
if width is not None:
264+
api_params['width'] = width
265+
if height is not None:
266+
api_params['height'] = height
267+
if background is not None:
268+
api_params['background'] = background
254269

255270
return self.client.call('get', api_path, {
256271
}, api_params)
@@ -289,9 +304,12 @@ def get_qr(self, text: str, size: Optional[float] = None, margin: Optional[float
289304

290305

291306
api_params['text'] = text
292-
api_params['size'] = size
293-
api_params['margin'] = margin
294-
api_params['download'] = download
307+
if size is not None:
308+
api_params['size'] = size
309+
if margin is not None:
310+
api_params['margin'] = margin
311+
if download is not None:
312+
api_params['download'] = download
295313

296314
return self.client.call('get', api_path, {
297315
}, api_params)

0 commit comments

Comments
 (0)