1
0
Fork 0
mirror of synced 2024-06-26 18:20:43 +12:00

Merge branch 'master' of github.com:appwrite/appwrite into 0.7.x

This commit is contained in:
Eldad Fux 2020-07-26 11:28:20 +03:00
commit 9cc665dd35
12 changed files with 356 additions and 62 deletions

View file

@ -195,7 +195,7 @@ return [
[
'key' => 'python',
'name' => 'Python',
'version' => '0.0.5',
'version' => '0.0.6',
'url' => 'https://github.com/appwrite/sdk-for-python',
'enabled' => true,
'beta' => true,

View file

@ -1,9 +1,9 @@
# Appwrite Python SDK
![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?v=1)
![Version](https://img.shields.io/badge/api%20version-0.6.1-blue.svg?v=1)
![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1)
**This SDK is compatible with Appwrite server version 0.6.1. For older versions, please check previous releases.**
**This SDK is compatible with Appwrite server version 0.6.2. For older versions, please check previous releases.**
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.
@ -27,4 +27,4 @@ This library is auto-generated by Appwrite custom [SDK Generator](https://github
## License
Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information.
Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information.

View file

@ -1,13 +1,13 @@
import io
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.5',
'x-sdk-version': 'appwrite:python:0.0.6',
}
def set_self_signed(self, status=True):
@ -47,24 +47,34 @@ class Client:
data = {}
json = {}
files = {}
self._global_headers.update(headers)
headers = {**self._global_headers, **headers}
if method != 'get':
data = params
params = {}
if headers['content-type'] == 'application/json':
if headers['content-type'].startswith('application/json'):
json = data
data = {}
if headers['content-type'].startswith('multipart/form-data'):
del headers['content-type']
for key in data.copy():
if isinstance(data[key], io.BufferedIOBase):
files[key] = data[key]
del data[key]
response = requests.request( # call method dynamically https://stackoverflow.com/a/4246075/2299554
method=method,
url=self._endpoint + path,
params=params,
data=data,
params=self.flatten(params),
data=self.flatten(data),
json=json,
headers=self._global_headers,
files=files,
headers=headers,
verify=self._self_signed,
)
@ -77,3 +87,20 @@ class Client:
return response._content
def flatten(self, data, prefix=''):
output = {}
i = 0
for key in data:
value = data[key] if isinstance(data, dict) else key
finalKey = prefix + '[' + key +']' if prefix else key
finalKey = prefix + '[' + str(i) +']' if isinstance(data, list) else finalKey
i += 1
if isinstance(value, list) or isinstance(value, dict):
output = {**output, **self.flatten(value, finalKey)}
else:
output[finalKey] = value
return output

View file

@ -11,4 +11,4 @@ client = Client()
database = Database(client)
result = database.create_collection('[NAME]', {}, {}, {})
result = database.create_collection('[NAME]', [], [], [])

View file

@ -11,4 +11,4 @@ client = Client()
database = Database(client)
result = database.create_document('[COLLECTION_ID]', {}, {}, {})
result = database.create_document('[COLLECTION_ID]', {}, [], [])

View file

@ -11,4 +11,4 @@ client = Client()
database = Database(client)
result = database.update_collection('[COLLECTION_ID]', '[NAME]', {}, {})
result = database.update_collection('[COLLECTION_ID]', '[NAME]', [], [])

View file

@ -11,4 +11,4 @@ client = Client()
database = Database(client)
result = database.update_document('[COLLECTION_ID]', '[DOCUMENT_ID]', {}, {}, {})
result = database.update_document('[COLLECTION_ID]', '[DOCUMENT_ID]', {}, [], [])

View file

@ -11,4 +11,4 @@ client = Client()
storage = Storage(client)
result = storage.create_file(document.getElementById('uploader').files[0], {}, {})
result = storage.create_file(open('/path/to/file.png', 'rb'), [], [])

View file

@ -11,4 +11,4 @@ client = Client()
storage = Storage(client)
result = storage.update_file('[FILE_ID]', {}, {})
result = storage.update_file('[FILE_ID]', [], [])

View file

@ -11,4 +11,4 @@ client = Client()
teams = Teams(client)
result = teams.create_membership('[TEAM_ID]', 'email@example.com', {}, 'https://example.com')
result = teams.create_membership('[TEAM_ID]', 'email@example.com', [], 'https://example.com')

View file

@ -3,7 +3,7 @@ import setuptools
setuptools.setup(
name = 'appwrite',
packages = ['appwrite', 'appwrite/services'],
version = '0.0.5',
version = '0.0.6',
license='BSD-3-Clause',
description = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API',
author = 'Appwrite Team',
@ -11,7 +11,7 @@ setuptools.setup(
maintainer = 'Appwrite Team',
maintainer_email = 'team@localhost.test',
url = 'https://appwrite.io/support',
download_url='https://github.com/appwrite/sdk-for-python/archive/0.0.5.tar.gz',
download_url='https://github.com/appwrite/sdk-for-python/archive/0.0.6.tar.gz',
# keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'],
install_requires=[
'requests',
@ -23,7 +23,6 @@ setuptools.setup(
'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',

350
composer.lock generated
View file

@ -792,6 +792,48 @@
],
"time": "2019-12-03T17:11:33+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v9.99.99.x-dev",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "0947f25b883d4172df340a0d95f1b7cdabc5368a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/0947f25b883d4172df340a0d95f1b7cdabc5368a",
"reference": "0947f25b883d4172df340a0d95f1b7cdabc5368a",
"shasum": ""
},
"require": {
"php": "^7"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*",
"vimeo/psalm": "^1"
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"polyfill",
"pseudorandom",
"random"
],
"time": "2018-08-07T13:07:48+00:00"
},
{
"name": "phpmailer/phpmailer",
"version": "v6.1.6",
@ -1127,17 +1169,18 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "a57f8161502549a742a63c09f0a604997bf47027"
"reference": "bc6549d068d0160e0f10f7a5a23c7d1406b95ebe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a57f8161502549a742a63c09f0a604997bf47027",
"reference": "a57f8161502549a742a63c09f0a604997bf47027",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/bc6549d068d0160e0f10f7a5a23c7d1406b95ebe",
"reference": "bc6549d068d0160e0f10f7a5a23c7d1406b95ebe",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/polyfill-mbstring": "^1.3",
"symfony/polyfill-intl-normalizer": "^1.10",
"symfony/polyfill-php70": "^1.10",
"symfony/polyfill-php72": "^1.10"
},
"suggest": {
@ -1146,7 +1189,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.17-dev"
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -1170,6 +1213,10 @@
"name": "Laurent Bassin",
"email": "laurent@bassin.info"
},
{
"name": "Trevor Rowbotham",
"email": "trevor.rowbotham@pm.me"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
@ -1185,32 +1232,46 @@
"portable",
"shim"
],
"time": "2020-06-06T08:46:27+00:00"
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"name": "symfony/polyfill-intl-normalizer",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "7110338d81ce1cbc3e273136e4574663627037a7"
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
"reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7110338d81ce1cbc3e273136e4574663627037a7",
"reference": "7110338d81ce1cbc3e273136e4574663627037a7",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e",
"reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
"ext-intl": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.17-dev"
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -1219,10 +1280,13 @@
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
@ -1239,16 +1303,108 @@
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"description": "Symfony polyfill for intl's Normalizer class and related functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"intl",
"normalizer",
"polyfill",
"portable",
"shim"
],
"time": "2020-06-06T08:46:27+00:00"
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "symfony/polyfill-php70",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php70.git",
"reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0dd93f2c578bdc9c72697eaa5f1dd25644e618d3",
"reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3",
"shasum": ""
},
"require": {
"paragonie/random_compat": "~1.0|~2.0|~9.99",
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php70\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "symfony/polyfill-php72",
@ -1256,12 +1412,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "3d9c70ff1b9f6bb618f9954b2f7f760220c2b38a"
"reference": "639447d008615574653fb3bc60d1986d7172eaae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/3d9c70ff1b9f6bb618f9954b2f7f760220c2b38a",
"reference": "3d9c70ff1b9f6bb618f9954b2f7f760220c2b38a",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/639447d008615574653fb3bc60d1986d7172eaae",
"reference": "639447d008615574653fb3bc60d1986d7172eaae",
"shasum": ""
},
"require": {
@ -1270,7 +1426,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.17-dev"
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -1307,7 +1463,21 @@
"portable",
"shim"
],
"time": "2020-06-06T08:46:27+00:00"
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "utopia-php/abuse",
@ -2239,18 +2409,18 @@
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "fa7f91090a63296a3c9af65e124384e19dad7e29"
"reference": "c99da517f9e7b6e6c4067611d804808c34d8cec3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/fa7f91090a63296a3c9af65e124384e19dad7e29",
"reference": "fa7f91090a63296a3c9af65e124384e19dad7e29",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/c99da517f9e7b6e6c4067611d804808c34d8cec3",
"reference": "c99da517f9e7b6e6c4067611d804808c34d8cec3",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.2",
"php": "^7.2",
"phpdocumentor/reflection-docblock": "^5.0",
"phpdocumentor/reflection-docblock": "^5.2",
"sebastian/comparator": "^3.0 || ^4.0",
"sebastian/recursion-context": "^3.0 || ^4.0"
},
@ -2294,7 +2464,7 @@
"spy",
"stub"
],
"time": "2020-07-09T10:28:49+00:00"
"time": "2020-07-21T10:09:02+00:00"
},
{
"name": "phpunit/php-code-coverage",
@ -3238,12 +3408,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d"
"reference": "1c302646f6efc070cd46856e600e5e0684d6b454"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d",
"reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454",
"reference": "1c302646f6efc070cd46856e600e5e0684d6b454",
"shasum": ""
},
"require": {
@ -3255,7 +3425,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.17-dev"
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -3292,27 +3462,118 @@
"polyfill",
"portable"
],
"time": "2020-06-06T08:46:27+00:00"
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "theseer/tokenizer",
"version": "1.1.3",
"name": "symfony/polyfill-mbstring",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/theseer/tokenizer.git",
"reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9"
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9",
"reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a",
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "theseer/tokenizer",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/theseer/tokenizer.git",
"reference": "75a63c33a8577608444246075ea0af0d052e452a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a",
"reference": "75a63c33a8577608444246075ea0af0d052e452a",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": "^7.0"
"php": "^7.2 || ^8.0"
},
"type": "library",
"autoload": {
@ -3332,7 +3593,13 @@
}
],
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"time": "2019-06-13T22:48:21+00:00"
"funding": [
{
"url": "https://github.com/theseer",
"type": "github"
}
],
"time": "2020-07-12T23:59:07+00:00"
},
{
"name": "twig/twig",
@ -3471,5 +3738,6 @@
"platform-dev": [],
"platform-overrides": {
"php": "7.4"
}
},
"plugin-api-version": "1.1.0"
}