Skip to content
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 13.6.1

* Fix passing of `None` to nullable parameters

## 13.6.0

* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance
Expand Down
4 changes: 2 additions & 2 deletions appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ def __init__(self):
self._endpoint = 'https://cloud.appwrite.io/v1'
self._global_headers = {
'content-type': '',
'user-agent' : f'AppwritePythonSDK/13.6.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'user-agent' : f'AppwritePythonSDK/13.6.1 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'x-sdk-name': 'Python',
'x-sdk-platform': 'server',
'x-sdk-language': 'python',
'x-sdk-version': '13.6.0',
'x-sdk-version': '13.6.1',
'X-Appwrite-Response-Format' : '1.8.0',
}

Expand Down
36 changes: 24 additions & 12 deletions appwrite/services/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def create(self, user_id: str, email: str, password: str, name: Optional[str] =
api_params['userId'] = user_id
api_params['email'] = email
api_params['password'] = password
api_params['name'] = name
if name is not None:
api_params['name'] = name

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

api_params['queries'] = queries
api_params['total'] = total
if queries is not None:
api_params['queries'] = queries
if total is not None:
api_params['total'] = total

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

api_params['queries'] = queries
api_params['total'] = total
if queries is not None:
api_params['queries'] = queries
if total is not None:
api_params['total'] = total

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


api_params['password'] = password
api_params['oldPassword'] = old_password
if old_password is not None:
api_params['oldPassword'] = old_password

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

api_params['userId'] = user_id
api_params['email'] = email
api_params['phrase'] = phrase
if phrase is not None:
api_params['phrase'] = phrase

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

api_params['userId'] = user_id
api_params['email'] = email
api_params['url'] = url
api_params['phrase'] = phrase
if url is not None:
api_params['url'] = url
if phrase is not None:
api_params['phrase'] = phrase

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

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

api_params['success'] = success
api_params['failure'] = failure
api_params['scopes'] = scopes
if success is not None:
api_params['success'] = success
if failure is not None:
api_params['failure'] = failure
if scopes is not None:
api_params['scopes'] = scopes

return self.client.call('get', api_path, {
}, api_params, response_type='location')
Expand Down
54 changes: 36 additions & 18 deletions appwrite/services/avatars.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ def get_browser(self, code: Browser, width: Optional[float] = None, height: Opti

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

api_params['width'] = width
api_params['height'] = height
api_params['quality'] = quality
if width is not None:
api_params['width'] = width
if height is not None:
api_params['height'] = height
if quality is not None:
api_params['quality'] = quality

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

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

api_params['width'] = width
api_params['height'] = height
api_params['quality'] = quality
if width is not None:
api_params['width'] = width
if height is not None:
api_params['height'] = height
if quality is not None:
api_params['quality'] = quality

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

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

api_params['width'] = width
api_params['height'] = height
api_params['quality'] = quality
if width is not None:
api_params['width'] = width
if height is not None:
api_params['height'] = height
if quality is not None:
api_params['quality'] = quality

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


api_params['url'] = url
api_params['width'] = width
api_params['height'] = height
if width is not None:
api_params['width'] = width
if height is not None:
api_params['height'] = height

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

api_params['name'] = name
api_params['width'] = width
api_params['height'] = height
api_params['background'] = background
if name is not None:
api_params['name'] = name
if width is not None:
api_params['width'] = width
if height is not None:
api_params['height'] = height
if background is not None:
api_params['background'] = background

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


api_params['text'] = text
api_params['size'] = size
api_params['margin'] = margin
api_params['download'] = download
if size is not None:
api_params['size'] = size
if margin is not None:
api_params['margin'] = margin
if download is not None:
api_params['download'] = download

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