Updated SDKs

This commit is contained in:
Eldad Fux
2020-02-23 20:09:34 +02:00
parent ccd8b31e1e
commit 34c85d62cd
436 changed files with 6014 additions and 144 deletions
+12
View File
@@ -0,0 +1,12 @@
Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+24
View File
@@ -0,0 +1,24 @@
# Appwrite SDK for Python
![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?v=1)
![Version](https://img.shields.io/badge/api%20version-0.5.0-blue.svg?v=1)
**This SDK is compatible with Appwrite server version . For older versions, please check previous releases.**
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)
## Installation
To install via [PyPI](https://pypi.org/):
```bash
pip install appwrite
```
## License
Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information.
@@ -0,0 +1 @@
+83
View File
@@ -0,0 +1,83 @@
import requests
class Client:
def __init__(self):
self._self_signed = False
self._endpoint = 'https://appwrite.io/v1'
self._global_headers = {
'content-type': '',
'x-sdk-version': 'appwrite:python:0.0.3',
}
def set_self_signed(self, status=True):
self._self_signed = status
return self
def set_endpoint(self, endpoint):
self._endpoint = endpoint
return self
def add_header(self, key, value):
self._global_headers[key.lower()] = value.lower()
return self
def set_project(self, value):
"""Your project ID"""
self._global_headers['x-appwrite-project'] = value.lower()
return self
def set_key(self, value):
"""Your secret API key"""
self._global_headers['x-appwrite-key'] = value.lower()
return self
def set_locale(self, value):
self._global_headers['x-appwrite-locale'] = value.lower()
return self
def set_mode(self, value):
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 = {}
data = {}
json = {}
self._global_headers.update(headers)
if method != 'get':
data = params
params = {}
if headers['content-type'] == 'application/json':
json = data
data = {}
response = requests.request( # call method dynamically https://stackoverflow.com/a/4246075/2299554
method=method,
url=self._endpoint + path,
params=params,
data=data,
json=json,
headers=self._global_headers,
verify=self._self_signed,
)
response.raise_for_status()
content_type = response.headers['Content-Type']
if content_type.startswith('application/json'):
return response.json()
return response._content
@@ -0,0 +1,6 @@
from .client import Client
class Service:
def __init__(self, client: Client):
self.client = client
@@ -0,0 +1 @@
@@ -0,0 +1,87 @@
from ..service import Service
class Avatars(Service):
def __init__(self, client):
super(Avatars, self).__init__(client)
def get_browser(self, code, width=100, height=100, quality=100):
"""Get Browser Icon"""
params = {}
path = '/avatars/browsers/{code}'
path = path.replace('{code}', code)
params['width'] = width
params['height'] = height
params['quality'] = quality
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_credit_card(self, code, width=100, height=100, quality=100):
"""Get Credit Card Icon"""
params = {}
path = '/avatars/credit-cards/{code}'
path = path.replace('{code}', code)
params['width'] = width
params['height'] = height
params['quality'] = quality
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_favicon(self, url):
"""Get Favicon"""
params = {}
path = '/avatars/favicon'
params['url'] = url
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_flag(self, code, width=100, height=100, quality=100):
"""Get Country Flag"""
params = {}
path = '/avatars/flags/{code}'
path = path.replace('{code}', code)
params['width'] = width
params['height'] = height
params['quality'] = quality
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_image(self, url, width=400, height=400):
"""Get Image from URL"""
params = {}
path = '/avatars/image'
params['url'] = url
params['width'] = width
params['height'] = height
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_q_r(self, text, size=400, margin=1, download=0):
"""Get QR Code"""
params = {}
path = '/avatars/qr'
params['text'] = text
params['size'] = size
params['margin'] = margin
params['download'] = download
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
@@ -0,0 +1,148 @@
from ..service import Service
class Database(Service):
def __init__(self, client):
super(Database, self).__init__(client)
def list_collections(self, search='', limit=25, offset=0, order_type='ASC'):
"""List Collections"""
params = {}
path = '/database/collections'
params['search'] = search
params['limit'] = limit
params['offset'] = offset
params['orderType'] = order_type
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def create_collection(self, name, read, write, rules):
"""Create Collection"""
params = {}
path = '/database/collections'
params['name'] = name
params['read'] = read
params['write'] = write
params['rules'] = rules
return self.client.call('post', path, {
'content-type': 'application/json',
}, params)
def get_collection(self, collection_id):
"""Get Collection"""
params = {}
path = '/database/collections/{collectionId}'
path = path.replace('{collectionId}', collection_id)
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def update_collection(self, collection_id, name, read, write, rules=[]):
"""Update Collection"""
params = {}
path = '/database/collections/{collectionId}'
path = path.replace('{collectionId}', collection_id)
params['name'] = name
params['read'] = read
params['write'] = write
params['rules'] = rules
return self.client.call('put', path, {
'content-type': 'application/json',
}, params)
def delete_collection(self, collection_id):
"""Delete Collection"""
params = {}
path = '/database/collections/{collectionId}'
path = path.replace('{collectionId}', collection_id)
return self.client.call('delete', path, {
'content-type': 'application/json',
}, params)
def list_documents(self, collection_id, filters=[], offset=0, limit=50, order_field='$id', order_type='ASC', order_cast='string', search='', first=0, last=0):
"""List Documents"""
params = {}
path = '/database/collections/{collectionId}/documents'
path = path.replace('{collectionId}', collection_id)
params['filters'] = filters
params['offset'] = offset
params['limit'] = limit
params['order-field'] = order_field
params['order-type'] = order_type
params['order-cast'] = order_cast
params['search'] = search
params['first'] = first
params['last'] = last
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def create_document(self, collection_id, data, read, write, parent_document='', parent_property='', parent_property_type='assign'):
"""Create Document"""
params = {}
path = '/database/collections/{collectionId}/documents'
path = path.replace('{collectionId}', collection_id)
params['data'] = data
params['read'] = read
params['write'] = write
params['parentDocument'] = parent_document
params['parentProperty'] = parent_property
params['parentPropertyType'] = parent_property_type
return self.client.call('post', path, {
'content-type': 'application/json',
}, params)
def get_document(self, collection_id, document_id):
"""Get Document"""
params = {}
path = '/database/collections/{collectionId}/documents/{documentId}'
path = path.replace('{collectionId}', collection_id)
path = path.replace('{documentId}', document_id)
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def update_document(self, collection_id, document_id, data, read, write):
"""Update Document"""
params = {}
path = '/database/collections/{collectionId}/documents/{documentId}'
path = path.replace('{collectionId}', collection_id)
path = path.replace('{documentId}', document_id)
params['data'] = data
params['read'] = read
params['write'] = write
return self.client.call('patch', path, {
'content-type': 'application/json',
}, params)
def delete_document(self, collection_id, document_id):
"""Delete Document"""
params = {}
path = '/database/collections/{collectionId}/documents/{documentId}'
path = path.replace('{collectionId}', collection_id)
path = path.replace('{documentId}', document_id)
return self.client.call('delete', path, {
'content-type': 'application/json',
}, params)
@@ -0,0 +1,67 @@
from ..service import Service
class Locale(Service):
def __init__(self, client):
super(Locale, self).__init__(client)
def get(self):
"""Get User Locale"""
params = {}
path = '/locale'
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_continents(self):
"""List Countries"""
params = {}
path = '/locale/continents'
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_countries(self):
"""List Countries"""
params = {}
path = '/locale/countries'
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_countries_e_u(self):
"""List EU Countries"""
params = {}
path = '/locale/countries/eu'
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_countries_phones(self):
"""List Countries Phone Codes"""
params = {}
path = '/locale/countries/phones'
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_currencies(self):
"""List Currencies"""
params = {}
path = '/locale/currencies'
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
@@ -0,0 +1,108 @@
from ..service import Service
class Storage(Service):
def __init__(self, client):
super(Storage, self).__init__(client)
def list_files(self, search='', limit=25, offset=0, order_type='ASC'):
"""List Files"""
params = {}
path = '/storage/files'
params['search'] = search
params['limit'] = limit
params['offset'] = offset
params['orderType'] = order_type
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def create_file(self, file, read, write):
"""Create File"""
params = {}
path = '/storage/files'
params['file'] = file
params['read'] = read
params['write'] = write
return self.client.call('post', path, {
'content-type': 'multipart/form-data',
}, params)
def get_file(self, file_id):
"""Get File"""
params = {}
path = '/storage/files/{fileId}'
path = path.replace('{fileId}', file_id)
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def update_file(self, file_id, read, write):
"""Update File"""
params = {}
path = '/storage/files/{fileId}'
path = path.replace('{fileId}', file_id)
params['read'] = read
params['write'] = write
return self.client.call('put', path, {
'content-type': 'application/json',
}, params)
def delete_file(self, file_id):
"""Delete File"""
params = {}
path = '/storage/files/{fileId}'
path = path.replace('{fileId}', file_id)
return self.client.call('delete', path, {
'content-type': 'application/json',
}, params)
def get_file_download(self, file_id):
"""Get File for Download"""
params = {}
path = '/storage/files/{fileId}/download'
path = path.replace('{fileId}', file_id)
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_file_preview(self, file_id, width=0, height=0, quality=100, background='', output=''):
"""Get File Preview"""
params = {}
path = '/storage/files/{fileId}/preview'
path = path.replace('{fileId}', file_id)
params['width'] = width
params['height'] = height
params['quality'] = quality
params['background'] = background
params['output'] = output
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_file_view(self, file_id, xas=''):
"""Get File for View"""
params = {}
path = '/storage/files/{fileId}/view'
path = path.replace('{fileId}', file_id)
params['as'] = xas
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
@@ -0,0 +1,105 @@
from ..service import Service
class Teams(Service):
def __init__(self, client):
super(Teams, self).__init__(client)
def list(self, search='', limit=25, offset=0, order_type='ASC'):
"""List Teams"""
params = {}
path = '/teams'
params['search'] = search
params['limit'] = limit
params['offset'] = offset
params['orderType'] = order_type
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def create(self, name, roles=[]):
"""Create Team"""
params = {}
path = '/teams'
params['name'] = name
params['roles'] = roles
return self.client.call('post', path, {
'content-type': 'application/json',
}, params)
def get(self, team_id):
"""Get Team"""
params = {}
path = '/teams/{teamId}'
path = path.replace('{teamId}', team_id)
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def update(self, team_id, name):
"""Update Team"""
params = {}
path = '/teams/{teamId}'
path = path.replace('{teamId}', team_id)
params['name'] = name
return self.client.call('put', path, {
'content-type': 'application/json',
}, params)
def delete(self, team_id):
"""Delete Team"""
params = {}
path = '/teams/{teamId}'
path = path.replace('{teamId}', team_id)
return self.client.call('delete', path, {
'content-type': 'application/json',
}, params)
def get_memberships(self, team_id):
"""Get Team Memberships"""
params = {}
path = '/teams/{teamId}/memberships'
path = path.replace('{teamId}', team_id)
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def create_membership(self, team_id, email, roles, url, name=''):
"""Create Team Membership"""
params = {}
path = '/teams/{teamId}/memberships'
path = path.replace('{teamId}', team_id)
params['email'] = email
params['name'] = name
params['roles'] = roles
params['url'] = url
return self.client.call('post', path, {
'content-type': 'application/json',
}, params)
def delete_membership(self, team_id, invite_id):
"""Delete Team Membership"""
params = {}
path = '/teams/{teamId}/memberships/{inviteId}'
path = path.replace('{teamId}', team_id)
path = path.replace('{inviteId}', invite_id)
return self.client.call('delete', path, {
'content-type': 'application/json',
}, params)
@@ -0,0 +1,125 @@
from ..service import Service
class Users(Service):
def __init__(self, client):
super(Users, self).__init__(client)
def list(self, search='', limit=25, offset=0, order_type='ASC'):
"""List Users"""
params = {}
path = '/users'
params['search'] = search
params['limit'] = limit
params['offset'] = offset
params['orderType'] = order_type
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def create(self, email, password, name=''):
"""Create User"""
params = {}
path = '/users'
params['email'] = email
params['password'] = password
params['name'] = name
return self.client.call('post', path, {
'content-type': 'application/json',
}, params)
def get(self, user_id):
"""Get User"""
params = {}
path = '/users/{userId}'
path = path.replace('{userId}', user_id)
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_logs(self, user_id):
"""Get User Logs"""
params = {}
path = '/users/{userId}/logs'
path = path.replace('{userId}', user_id)
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def get_prefs(self, user_id):
"""Get User Preferences"""
params = {}
path = '/users/{userId}/prefs'
path = path.replace('{userId}', user_id)
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def update_prefs(self, user_id, prefs):
"""Update User Preferences"""
params = {}
path = '/users/{userId}/prefs'
path = path.replace('{userId}', user_id)
params['prefs'] = prefs
return self.client.call('patch', path, {
'content-type': 'application/json',
}, params)
def get_sessions(self, user_id):
"""Get User Sessions"""
params = {}
path = '/users/{userId}/sessions'
path = path.replace('{userId}', user_id)
return self.client.call('get', path, {
'content-type': 'application/json',
}, params)
def delete_sessions(self, user_id):
"""Delete User Sessions"""
params = {}
path = '/users/{userId}/sessions'
path = path.replace('{userId}', user_id)
return self.client.call('delete', path, {
'content-type': 'application/json',
}, params)
def delete_session(self, user_id, session_id):
"""Delete User Session"""
params = {}
path = '/users/{userId}/sessions/:session'
path = path.replace('{userId}', user_id)
params['sessionId'] = session_id
return self.client.call('delete', path, {
'content-type': 'application/json',
}, params)
def update_status(self, user_id, status):
"""Update User Status"""
params = {}
path = '/users/{userId}/status'
path = path.replace('{userId}', user_id)
params['status'] = status
return self.client.call('patch', path, {
'content-type': 'application/json',
}, params)
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.avatars import Avatars
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
avatars = Avatars(client)
result = avatars.get_browser('aa')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.avatars import Avatars
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
avatars = Avatars(client)
result = avatars.get_credit_card('amex')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.avatars import Avatars
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
avatars = Avatars(client)
result = avatars.get_favicon('https://example.com')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.avatars import Avatars
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
avatars = Avatars(client)
result = avatars.get_flag('af')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.avatars import Avatars
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
avatars = Avatars(client)
result = avatars.get_image('https://example.com')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.avatars import Avatars
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
avatars = Avatars(client)
result = avatars.get_q_r('[TEXT]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.database import Database
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
database = Database(client)
result = database.create_collection('[NAME]', {}, {}, {})
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.database import Database
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
database = Database(client)
result = database.create_document('[COLLECTION_ID]', {}, {}, {})
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.database import Database
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
database = Database(client)
result = database.delete_collection('[COLLECTION_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.database import Database
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
database = Database(client)
result = database.delete_document('[COLLECTION_ID]', '[DOCUMENT_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.database import Database
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
database = Database(client)
result = database.get_collection('[COLLECTION_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.database import Database
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
database = Database(client)
result = database.get_document('[COLLECTION_ID]', '[DOCUMENT_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.database import Database
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
database = Database(client)
result = database.list_collections()
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.database import Database
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
database = Database(client)
result = database.list_documents('[COLLECTION_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.database import Database
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
database = Database(client)
result = database.update_collection('[COLLECTION_ID]', '[NAME]', {}, {})
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.database import Database
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
database = Database(client)
result = database.update_document('[COLLECTION_ID]', '[DOCUMENT_ID]', {}, {}, {})
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.locale import Locale
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
locale = Locale(client)
result = locale.get_continents()
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.locale import Locale
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
locale = Locale(client)
result = locale.get_countries_e_u()
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.locale import Locale
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
locale = Locale(client)
result = locale.get_countries_phones()
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.locale import Locale
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
locale = Locale(client)
result = locale.get_countries()
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.locale import Locale
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
locale = Locale(client)
result = locale.get_currencies()
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.locale import Locale
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
locale = Locale(client)
result = locale.get()
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
storage = Storage(client)
result = storage.create_file(document.getElementById('uploader').files[0], {}, {})
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
storage = Storage(client)
result = storage.delete_file('[FILE_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
storage = Storage(client)
result = storage.get_file_download('[FILE_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
storage = Storage(client)
result = storage.get_file_preview('[FILE_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
storage = Storage(client)
result = storage.get_file_view('[FILE_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
storage = Storage(client)
result = storage.get_file('[FILE_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
storage = Storage(client)
result = storage.list_files()
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
storage = Storage(client)
result = storage.update_file('[FILE_ID]', {}, {})
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.teams import Teams
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
teams = Teams(client)
result = teams.create_membership('[TEAM_ID]', 'email@example.com', {}, 'https://example.com')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.teams import Teams
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
teams = Teams(client)
result = teams.create('[NAME]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.teams import Teams
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
teams = Teams(client)
result = teams.delete_membership('[TEAM_ID]', '[INVITE_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.teams import Teams
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
teams = Teams(client)
result = teams.delete('[TEAM_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.teams import Teams
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
teams = Teams(client)
result = teams.get_memberships('[TEAM_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.teams import Teams
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
teams = Teams(client)
result = teams.get('[TEAM_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.teams import Teams
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
teams = Teams(client)
result = teams.list()
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.teams import Teams
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
teams = Teams(client)
result = teams.update('[TEAM_ID]', '[NAME]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.create('email@example.com', 'password')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.delete_session('[USER_ID]', '[SESSION_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.delete_sessions('[USER_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.get_logs('[USER_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.get_prefs('[USER_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.get_sessions('[USER_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.get('[USER_ID]')
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.list()
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.update_prefs('[USER_ID]', {})
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.update_status('[USER_ID]', '1')
+1
View File
@@ -0,0 +1 @@
requests==2.22.0
+2
View File
@@ -0,0 +1,2 @@
[metadata]
description-file = README.md
+31
View File
@@ -0,0 +1,31 @@
import setuptools
setuptools.setup(
name = 'appwrite',
packages = ['appwrite', 'appwrite/services'],
version = '0.0.3',
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/0.0.3.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 License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
)