From cc5e33ba6b95f685c896eaadbc4da8ccbb1cd511 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 16 Sep 2019 21:29:53 +0200 Subject: [PATCH 1/2] Updated client.py Added type checking and fixed some smaller stuff --- appwrite/client.py | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/appwrite/client.py b/appwrite/client.py index d3a9afb..fce2067 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -1,6 +1,5 @@ import requests - class Client: def __init__(self): self._self_signed = False @@ -18,48 +17,57 @@ def set_endpoint(self, endpoint): self._endpoint = endpoint return self - def add_header(self, key, value): + def add_header(self, key: str, value: str): + if not (isinstance (key, str) or isinstance (value, str)): + raise TypeError ("Both key and value must be a string!") + self._global_headers[key.lower()] = value.lower() return self - def set_project(self, value): + def set_project(self, value: str): """Your Appwrite project ID. You can find your project ID in your Appwrite console project settings.""" + if not isinstance (value, str): + raise TypeError ("Value must be a string!") + self._global_headers['x-appwrite-project'] = value.lower() return self - def set_key(self, value): + def set_key(self, value: str): """Your Appwrite project secret key. You can can create a new API key from your Appwrite console API keys dashboard.""" + if not isinstance (value, str): + raise TypeError ("Value must be a string!") + self._global_headers['x-appwrite-key'] = value.lower() return self - def set_locale(self, value): + def set_locale(self, value: str): + if not isinstance (value, str): + raise TypeError ("Value must be a string!") + self._global_headers['x-appwrite-locale'] = value.lower() return self - def set_mode(self, value): + def set_mode(self, value: str): + if not isinstance (value, str): + raise TypeError ("Value must be a string!") + self._global_headers['x-appwrite-mode'] = value.lower() return self - def call(self, method, path='', headers=None, params=None): - if headers is None: - headers = {} - - if params is None: - params = {} - + def call(self, method, path='', headers={}, params={}): data = {} json = {} headers = {**self._global_headers, **headers} if method != 'get': data = params - params = {} + params.clear () if headers['content-type'] == 'application/json': json = data - data = {} + data.clear () response = getattr(requests, method)( # call method dynamically https://stackoverflow.com/a/4246075/2299554 url=self._endpoint + path, @@ -67,7 +75,7 @@ def call(self, method, path='', headers=None, params=None): data=data, json=json, headers=headers, - verify=self._self_signed, + verify=self._self_signed ) return response From ed71ca423f275242b6b8533e93559cf24b0334fc Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 16 Sep 2019 21:46:44 +0200 Subject: [PATCH 2/2] Linked things, added todo list and example --- .gitignore | 104 ++++++++++++++++++++++++++++++++++ README.md | 20 ++++++- appwrite/__init__.py | 2 +- appwrite/service.py | 1 - appwrite/services/__init__.py | 10 +++- appwrite/services/account.py | 2 - appwrite/services/auth.py | 10 ++-- appwrite/services/avatars.py | 8 +-- appwrite/services/database.py | 26 ++++----- appwrite/services/locale.py | 2 - appwrite/services/projects.py | 76 ++++++++++++------------- appwrite/services/storage.py | 16 +++--- appwrite/services/teams.py | 26 ++++----- appwrite/services/users.py | 16 +++--- setup.py | 56 +++++++++--------- 15 files changed, 245 insertions(+), 130 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..894a44c --- /dev/null +++ b/.gitignore @@ -0,0 +1,104 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ diff --git a/README.md b/README.md index 08f7338..129ede5 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) - ![Appwrite](https://appwrite.io/images/github.png) **API Version: latest** @@ -21,6 +20,23 @@ To install via [PyPI](https://pypi.org/): pip install appwrite ``` +## Example + +Here's a small and simple example: +```py +from appwrite import Account + +account = Account () +... +``` + +## Todo + +ToDo list: +- Fix weird function arguments in `database.py` (`appwrite/services/database.py`) +- Fix weird function arguments in `storage.py` (`appwrite/services/storage.py`) +- Fix weird function arguments in `teams.py` (`appwrite/services/teams.py`) + ## License -Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. diff --git a/appwrite/__init__.py b/appwrite/__init__.py index 0519ecb..3ff722b 100644 --- a/appwrite/__init__.py +++ b/appwrite/__init__.py @@ -1 +1 @@ - \ No newline at end of file +from .client import Client diff --git a/appwrite/service.py b/appwrite/service.py index b5b60e6..f5e2adb 100644 --- a/appwrite/service.py +++ b/appwrite/service.py @@ -1,6 +1,5 @@ from .client import Client - class Service: def __init__(self, client: Client): self.client = client diff --git a/appwrite/services/__init__.py b/appwrite/services/__init__.py index 0519ecb..d3f1631 100644 --- a/appwrite/services/__init__.py +++ b/appwrite/services/__init__.py @@ -1 +1,9 @@ - \ No newline at end of file +from .account import Account +from .auth import Auth +from .avatars import Avatars +from .database import Databse # Fix function arguments +from .locale import Locale +from .projects import Projects +from .storage import Storage # Fix function arguments +from .teams import Teams # Fix function arguments +from .users import Users diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 4ea82c4..059dd23 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -1,8 +1,6 @@ from ..service import Service - class Account(Service): - def get(self): """Get Account""" diff --git a/appwrite/services/auth.py b/appwrite/services/auth.py index ddf7469..5532701 100644 --- a/appwrite/services/auth.py +++ b/appwrite/services/auth.py @@ -1,8 +1,6 @@ from ..service import Service - class Auth(Service): - def login(self, email, password, success='', failure=''): """Login User""" @@ -30,7 +28,7 @@ def logout_by_session(self, id): params = {} path = '/auth/logout/{id}' - path.replace('{id}', id) + path.replace('{id}', id) return self.client.call('delete', path, { }, params) @@ -40,8 +38,8 @@ def oauth_callback(self, project_id, provider, code, state=''): params = {} path = '/auth/oauth/callback/{provider}/{projectId}' - path.replace('{projectId}', project_id) - path.replace('{provider}', provider) + path.replace('{projectId}', project_id) + path.replace('{provider}', provider) params['code'] = code params['state'] = state @@ -53,7 +51,7 @@ def oauth(self, provider, success='', failure=''): params = {} path = '/auth/oauth/{provider}' - path.replace('{provider}', provider) + path.replace('{provider}', provider) params['success'] = success params['failure'] = failure diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index f6e463a..641ee14 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -1,14 +1,12 @@ from ..service import Service - class Avatars(Service): - def get_browser(self, code, width=100, height=100, quality=100): """Get Browser Icon""" params = {} path = '/avatars/browsers/{code}' - path.replace('{code}', code) + path.replace('{code}', code) params['width'] = width params['height'] = height params['quality'] = quality @@ -21,7 +19,7 @@ def get_credit_card(self, code, width=100, height=100, quality=100): params = {} path = '/avatars/credit-cards/{code}' - path.replace('{code}', code) + path.replace('{code}', code) params['width'] = width params['height'] = height params['quality'] = quality @@ -44,7 +42,7 @@ def get_flag(self, code, width=100, height=100, quality=100): params = {} path = '/avatars/flags/{code}' - path.replace('{code}', code) + path.replace('{code}', code) params['width'] = width params['height'] = height params['quality'] = quality diff --git a/appwrite/services/database.py b/appwrite/services/database.py index d0facb8..faf2fca 100644 --- a/appwrite/services/database.py +++ b/appwrite/services/database.py @@ -1,8 +1,8 @@ -from ..service import Service +# theres a lot of weird function arguments in this script +from ..service import Service class Database(Service): - def list_collections(self, search='', limit=25, offset=0, order_type='ASC'): """List Collections""" @@ -37,7 +37,7 @@ def get_collection(self, collection_id): params = {} path = '/database/{collectionId}' - path.replace('{collectionId}', collection_id) + path.replace('{collectionId}', collection_id) return self.client.call('get', path, { }, params) @@ -50,7 +50,7 @@ def update_collection(self, collection_id, name, readstring(4) ""[]"" params = {} path = '/database/{collectionId}' - path.replace('{collectionId}', collection_id) + path.replace('{collectionId}', collection_id) params['name'] = name params['read'] = read params['write'] = write @@ -64,7 +64,7 @@ def delete_collection(self, collection_id): params = {} path = '/database/{collectionId}' - path.replace('{collectionId}', collection_id) + path.replace('{collectionId}', collection_id) return self.client.call('delete', path, { }, params) @@ -75,7 +75,7 @@ def list_documents(self, collection_id, filtersstring(4) ""[]"" params = {} path = '/database/{collectionId}/documents' - path.replace('{collectionId}', collection_id) + path.replace('{collectionId}', collection_id) params['filters'] = filters params['offset'] = offset params['limit'] = limit @@ -96,7 +96,7 @@ def create_document(self, collection_id, data, readstring(4) ""[]"" params = {} path = '/database/{collectionId}/documents' - path.replace('{collectionId}', collection_id) + path.replace('{collectionId}', collection_id) params['data'] = data params['read'] = read params['write'] = write @@ -112,8 +112,8 @@ def get_document(self, collection_id, document_id): params = {} path = '/database/{collectionId}/documents/{documentId}' - path.replace('{collectionId}', collection_id) - path.replace('{documentId}', document_id) + path.replace('{collectionId}', collection_id) + path.replace('{documentId}', document_id) return self.client.call('get', path, { }, params) @@ -125,8 +125,8 @@ def update_document(self, collection_id, document_id, data, readstring(4) ""[]"" params = {} path = '/database/{collectionId}/documents/{documentId}' - path.replace('{collectionId}', collection_id) - path.replace('{documentId}', document_id) + path.replace('{collectionId}', collection_id) + path.replace('{documentId}', document_id) params['data'] = data params['read'] = read params['write'] = write @@ -139,8 +139,8 @@ def delete_document(self, collection_id, document_id): params = {} path = '/database/{collectionId}/documents/{documentId}' - path.replace('{collectionId}', collection_id) - path.replace('{documentId}', document_id) + path.replace('{collectionId}', collection_id) + path.replace('{documentId}', document_id) return self.client.call('delete', path, { }, params) diff --git a/appwrite/services/locale.py b/appwrite/services/locale.py index fef156b..03890a5 100644 --- a/appwrite/services/locale.py +++ b/appwrite/services/locale.py @@ -1,8 +1,6 @@ from ..service import Service - class Locale(Service): - def get_locale(self): """Get User Locale""" diff --git a/appwrite/services/projects.py b/appwrite/services/projects.py index 5dc676e..f127b00 100644 --- a/appwrite/services/projects.py +++ b/appwrite/services/projects.py @@ -1,8 +1,6 @@ from ..service import Service - class Projects(Service): - def list_projects(self): """List Projects""" @@ -37,7 +35,7 @@ def get_project(self, project_id): params = {} path = '/projects/{projectId}' - path.replace('{projectId}', project_id) + path.replace('{projectId}', project_id) return self.client.call('get', path, { }, params) @@ -47,7 +45,7 @@ def update_project(self, project_id, name, description='', logo='', url='', lega params = {} path = '/projects/{projectId}' - path.replace('{projectId}', project_id) + path.replace('{projectId}', project_id) params['name'] = name params['description'] = description params['logo'] = logo @@ -67,7 +65,7 @@ def delete_project(self, project_id): params = {} path = '/projects/{projectId}' - path.replace('{projectId}', project_id) + path.replace('{projectId}', project_id) return self.client.call('delete', path, { }, params) @@ -77,7 +75,7 @@ def list_keys(self, project_id): params = {} path = '/projects/{projectId}/keys' - path.replace('{projectId}', project_id) + path.replace('{projectId}', project_id) return self.client.call('get', path, { }, params) @@ -87,7 +85,7 @@ def create_key(self, project_id, name, scopes): params = {} path = '/projects/{projectId}/keys' - path.replace('{projectId}', project_id) + path.replace('{projectId}', project_id) params['name'] = name params['scopes'] = scopes @@ -99,8 +97,8 @@ def get_key(self, project_id, key_id): params = {} path = '/projects/{projectId}/keys/{keyId}' - path.replace('{projectId}', project_id) - path.replace('{keyId}', key_id) + path.replace('{projectId}', project_id) + path.replace('{keyId}', key_id) return self.client.call('get', path, { }, params) @@ -110,8 +108,8 @@ def update_key(self, project_id, key_id, name, scopes): params = {} path = '/projects/{projectId}/keys/{keyId}' - path.replace('{projectId}', project_id) - path.replace('{keyId}', key_id) + path.replace('{projectId}', project_id) + path.replace('{keyId}', key_id) params['name'] = name params['scopes'] = scopes @@ -123,8 +121,8 @@ def delete_key(self, project_id, key_id): params = {} path = '/projects/{projectId}/keys/{keyId}' - path.replace('{projectId}', project_id) - path.replace('{keyId}', key_id) + path.replace('{projectId}', project_id) + path.replace('{keyId}', key_id) return self.client.call('delete', path, { }, params) @@ -134,7 +132,7 @@ def update_project_o_auth(self, project_id, provider, app_id='', secret=''): params = {} path = '/projects/{projectId}/oauth' - path.replace('{projectId}', project_id) + path.replace('{projectId}', project_id) params['provider'] = provider params['appId'] = app_id params['secret'] = secret @@ -147,7 +145,7 @@ def list_platforms(self, project_id): params = {} path = '/projects/{projectId}/platforms' - path.replace('{projectId}', project_id) + path.replace('{projectId}', project_id) return self.client.call('get', path, { }, params) @@ -157,7 +155,7 @@ def create_platform(self, project_id, type, name, key='', store='', url=''): params = {} path = '/projects/{projectId}/platforms' - path.replace('{projectId}', project_id) + path.replace('{projectId}', project_id) params['type'] = type params['name'] = name params['key'] = key @@ -172,8 +170,8 @@ def get_platform(self, project_id, platform_id): params = {} path = '/projects/{projectId}/platforms/{platformId}' - path.replace('{projectId}', project_id) - path.replace('{platformId}', platform_id) + path.replace('{projectId}', project_id) + path.replace('{platformId}', platform_id) return self.client.call('get', path, { }, params) @@ -183,8 +181,8 @@ def update_platform(self, project_id, platform_id, name, key='', store='', url=' params = {} path = '/projects/{projectId}/platforms/{platformId}' - path.replace('{projectId}', project_id) - path.replace('{platformId}', platform_id) + path.replace('{projectId}', project_id) + path.replace('{platformId}', platform_id) params['name'] = name params['key'] = key params['store'] = store @@ -198,8 +196,8 @@ def delete_platform(self, project_id, platform_id): params = {} path = '/projects/{projectId}/platforms/{platformId}' - path.replace('{projectId}', project_id) - path.replace('{platformId}', platform_id) + path.replace('{projectId}', project_id) + path.replace('{platformId}', platform_id) return self.client.call('delete', path, { }, params) @@ -209,7 +207,7 @@ def list_tasks(self, project_id): params = {} path = '/projects/{projectId}/tasks' - path.replace('{projectId}', project_id) + path.replace('{projectId}', project_id) return self.client.call('get', path, { }, params) @@ -219,7 +217,7 @@ def create_task(self, project_id, name, status, schedule, security, http_method, params = {} path = '/projects/{projectId}/tasks' - path.replace('{projectId}', project_id) + path.replace('{projectId}', project_id) params['name'] = name params['status'] = status params['schedule'] = schedule @@ -238,8 +236,8 @@ def get_task(self, project_id, task_id): params = {} path = '/projects/{projectId}/tasks/{taskId}' - path.replace('{projectId}', project_id) - path.replace('{taskId}', task_id) + path.replace('{projectId}', project_id) + path.replace('{taskId}', task_id) return self.client.call('get', path, { }, params) @@ -249,8 +247,8 @@ def update_task(self, project_id, task_id, name, status, schedule, security, htt params = {} path = '/projects/{projectId}/tasks/{taskId}' - path.replace('{projectId}', project_id) - path.replace('{taskId}', task_id) + path.replace('{projectId}', project_id) + path.replace('{taskId}', task_id) params['name'] = name params['status'] = status params['schedule'] = schedule @@ -269,8 +267,8 @@ def delete_task(self, project_id, task_id): params = {} path = '/projects/{projectId}/tasks/{taskId}' - path.replace('{projectId}', project_id) - path.replace('{taskId}', task_id) + path.replace('{projectId}', project_id) + path.replace('{taskId}', task_id) return self.client.call('delete', path, { }, params) @@ -280,7 +278,7 @@ def get_project_usage(self, project_id): params = {} path = '/projects/{projectId}/usage' - path.replace('{projectId}', project_id) + path.replace('{projectId}', project_id) return self.client.call('get', path, { }, params) @@ -290,7 +288,7 @@ def list_webhooks(self, project_id): params = {} path = '/projects/{projectId}/webhooks' - path.replace('{projectId}', project_id) + path.replace('{projectId}', project_id) return self.client.call('get', path, { }, params) @@ -300,7 +298,7 @@ def create_webhook(self, project_id, name, events, url, security, http_user='', params = {} path = '/projects/{projectId}/webhooks' - path.replace('{projectId}', project_id) + path.replace('{projectId}', project_id) params['name'] = name params['events'] = events params['url'] = url @@ -316,8 +314,8 @@ def get_webhook(self, project_id, webhook_id): params = {} path = '/projects/{projectId}/webhooks/{webhookId}' - path.replace('{projectId}', project_id) - path.replace('{webhookId}', webhook_id) + path.replace('{projectId}', project_id) + path.replace('{webhookId}', webhook_id) return self.client.call('get', path, { }, params) @@ -327,8 +325,8 @@ def update_webhook(self, project_id, webhook_id, name, events, url, security, ht params = {} path = '/projects/{projectId}/webhooks/{webhookId}' - path.replace('{projectId}', project_id) - path.replace('{webhookId}', webhook_id) + path.replace('{projectId}', project_id) + path.replace('{webhookId}', webhook_id) params['name'] = name params['events'] = events params['url'] = url @@ -344,8 +342,8 @@ def delete_webhook(self, project_id, webhook_id): params = {} path = '/projects/{projectId}/webhooks/{webhookId}' - path.replace('{projectId}', project_id) - path.replace('{webhookId}', webhook_id) + path.replace('{projectId}', project_id) + path.replace('{webhookId}', webhook_id) return self.client.call('delete', path, { }, params) diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index 0df4a46..96a1ebf 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -1,8 +1,8 @@ -from ..service import Service +# theres a lot of weird function arguments in this script +from ..service import Service class Storage(Service): - def list_files(self, search='', limit=25, offset=0, order_type='ASC'): """List Files""" @@ -37,7 +37,7 @@ def get_file(self, file_id): params = {} path = '/storage/files/{fileId}' - path.replace('{fileId}', file_id) + path.replace('{fileId}', file_id) return self.client.call('get', path, { }, params) @@ -49,7 +49,7 @@ def update_file(self, file_id, readstring(4) ""[]"" params = {} path = '/storage/files/{fileId}' - path.replace('{fileId}', file_id) + path.replace('{fileId}', file_id) params['read'] = read params['write'] = write params['folderId'] = folder_id @@ -62,7 +62,7 @@ def delete_file(self, file_id): params = {} path = '/storage/files/{fileId}' - path.replace('{fileId}', file_id) + path.replace('{fileId}', file_id) return self.client.call('delete', path, { }, params) @@ -72,7 +72,7 @@ def get_file_download(self, file_id): params = {} path = '/storage/files/{fileId}/download' - path.replace('{fileId}', file_id) + path.replace('{fileId}', file_id) return self.client.call('get', path, { }, params) @@ -82,7 +82,7 @@ def get_file_preview(self, file_id, width=0, height=0, quality=100, background=' params = {} path = '/storage/files/{fileId}/preview' - path.replace('{fileId}', file_id) + path.replace('{fileId}', file_id) params['width'] = width params['height'] = height params['quality'] = quality @@ -97,7 +97,7 @@ def get_file_view(self, file_id, as=''): params = {} path = '/storage/files/{fileId}/view' - path.replace('{fileId}', file_id) + path.replace('{fileId}', file_id) params['as'] = as return self.client.call('get', path, { diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index f7e5f62..081fa1a 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -1,8 +1,8 @@ -from ..service import Service +# theres a lot of weird function arguments in this script +from ..service import Service class Teams(Service): - def list_teams(self, search='', limit=25, offset=0, order_type='ASC'): """List Teams""" @@ -33,7 +33,7 @@ def get_team(self, team_id): params = {} path = '/teams/{teamId}' - path.replace('{teamId}', team_id) + path.replace('{teamId}', team_id) return self.client.call('get', path, { }, params) @@ -43,7 +43,7 @@ def update_team(self, team_id, name): params = {} path = '/teams/{teamId}' - path.replace('{teamId}', team_id) + path.replace('{teamId}', team_id) params['name'] = name return self.client.call('put', path, { @@ -54,7 +54,7 @@ def delete_team(self, team_id): params = {} path = '/teams/{teamId}' - path.replace('{teamId}', team_id) + path.replace('{teamId}', team_id) return self.client.call('delete', path, { }, params) @@ -64,7 +64,7 @@ def get_team_members(self, team_id): params = {} path = '/teams/{teamId}/members' - path.replace('{teamId}', team_id) + path.replace('{teamId}', team_id) return self.client.call('get', path, { }, params) @@ -74,7 +74,7 @@ def create_team_membership(self, team_id, email, roles, redirect, name=''): params = {} path = '/teams/{teamId}/memberships' - path.replace('{teamId}', team_id) + path.replace('{teamId}', team_id) params['email'] = email params['name'] = name params['roles'] = roles @@ -88,8 +88,8 @@ def delete_team_membership(self, team_id, invite_id): params = {} path = '/teams/{teamId}/memberships/{inviteId}' - path.replace('{teamId}', team_id) - path.replace('{inviteId}', invite_id) + path.replace('{teamId}', team_id) + path.replace('{inviteId}', invite_id) return self.client.call('delete', path, { }, params) @@ -99,8 +99,8 @@ def create_team_membership_resend(self, team_id, invite_id, redirect): params = {} path = '/teams/{teamId}/memberships/{inviteId}/resend' - path.replace('{teamId}', team_id) - path.replace('{inviteId}', invite_id) + path.replace('{teamId}', team_id) + path.replace('{inviteId}', invite_id) params['redirect'] = redirect return self.client.call('post', path, { @@ -111,8 +111,8 @@ def update_team_membership_status(self, team_id, invite_id, user_id, secret, suc params = {} path = '/teams/{teamId}/memberships/{inviteId}/status' - path.replace('{teamId}', team_id) - path.replace('{inviteId}', invite_id) + path.replace('{teamId}', team_id) + path.replace('{inviteId}', invite_id) params['userId'] = user_id params['secret'] = secret params['success'] = success diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 33e26d7..4a0705b 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -1,8 +1,6 @@ from ..service import Service - class Users(Service): - def list_users(self, search='', limit=25, offset=0, order_type='ASC'): """List Users""" @@ -33,7 +31,7 @@ def get_user(self, user_id): params = {} path = '/users/{userId}' - path.replace('{userId}', user_id) + path.replace('{userId}', user_id) return self.client.call('get', path, { }, params) @@ -43,7 +41,7 @@ def get_user_logs(self, user_id): params = {} path = '/users/{userId}/logs' - path.replace('{userId}', user_id) + path.replace('{userId}', user_id) return self.client.call('get', path, { }, params) @@ -53,7 +51,7 @@ def get_user_prefs(self, user_id): params = {} path = '/users/{userId}/prefs' - path.replace('{userId}', user_id) + path.replace('{userId}', user_id) return self.client.call('get', path, { }, params) @@ -63,7 +61,7 @@ def get_user_sessions(self, user_id): params = {} path = '/users/{userId}/sessions' - path.replace('{userId}', user_id) + path.replace('{userId}', user_id) return self.client.call('get', path, { }, params) @@ -73,7 +71,7 @@ def delete_user_sessions(self, user_id): params = {} path = '/users/{userId}/sessions' - path.replace('{userId}', user_id) + path.replace('{userId}', user_id) return self.client.call('delete', path, { }, params) @@ -83,7 +81,7 @@ def delete_users_session(self, user_id, session_id): params = {} path = '/users/{userId}/sessions/:session' - path.replace('{userId}', user_id) + path.replace('{userId}', user_id) params['sessionId'] = session_id return self.client.call('delete', path, { @@ -94,7 +92,7 @@ def update_user_status(self, user_id, status): params = {} path = '/users/{userId}/status' - path.replace('{userId}', user_id) + path.replace('{userId}', user_id) params['status'] = status return self.client.call('patch', path, { diff --git a/setup.py b/setup.py index 9f2b191..0bd0d57 100644 --- a/setup.py +++ b/setup.py @@ -1,31 +1,31 @@ from distutils.core import setup setup( - name = 'appwrite', - packages = ['appwrite'], - version = 'v1.0.0', - license='BSD-3-Clause', - description = 'Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)', - author = 'Appwrite Team', - author_email = 'team@appwrite.io', - maintainer = 'Appwrite Team', - maintainer_email = 'team@appwrite.io', - url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/v1.0.0.tar.gz', - # keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'], - install_requires=[ - 'requests', - ], - classifiers=[ - 'Development Status :: 5 - PRODUCTION/STABLE', - 'Intended Audience :: Developers', - 'Environment :: Web Environment', - 'Topic :: Software Development', - 'License :: OSI Approved :: BSD-3-Clause', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - ], -) \ No newline at end of file + name = 'appwrite', + packages = ['appwrite'], + version = 'v1.0.0', + license='BSD-3-Clause', + description = 'Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)', + author = 'Appwrite Team', + author_email = 'team@appwrite.io', + maintainer = 'Appwrite Team', + maintainer_email = 'team@appwrite.io', + url = 'https://appwrite.io/support', + download_url='https://github.com/appwrite/sdk-for-python/archive/v1.0.0.tar.gz', + # keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'], + install_requires=[ + 'requests', + ], + classifiers=[ + 'Development Status :: 5 - PRODUCTION/STABLE', + 'Intended Audience :: Developers', + 'Environment :: Web Environment', + 'Topic :: Software Development', + 'License :: OSI Approved :: BSD-3-Clause', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + ], +)