Skip to content

Commit 181c45d

Browse files
committed
Initial commit
1 parent 9f2f7b3 commit 181c45d

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Appwrite SDK for Python
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?v=1)
4-
![Version](https://img.shields.io/badge/api%20version-0.3.0-blue.svg?v=1)
4+
![Version](https://img.shields.io/badge/api%20version-0.4.0-blue.svg?v=1)
55

66
**WORK IN PROGRESS - NOT READY FOR USAGE - Want to help us improve this client SDK? Send a pull request to Appwrite [SDK generator repository](https://github.com/appwrite/sdk-generator).**
77

appwrite/client.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def __init__(self):
77
self._endpoint = 'https://appwrite.io/v1'
88
self._global_headers = {
99
'content-type': '',
10-
'x-sdk-version': 'appwrite:python:0.0.2',
10+
'x-sdk-version': 'appwrite:python:0.0.3',
1111
}
1212

1313
def set_self_signed(self, status=True):
@@ -51,7 +51,8 @@ def call(self, method, path='', headers=None, params=None):
5151

5252
data = {}
5353
json = {}
54-
headers = {**self._global_headers, **headers}
54+
55+
self._global_headers.update(headers)
5556

5657
if method != 'get':
5758
data = params
@@ -61,13 +62,16 @@ def call(self, method, path='', headers=None, params=None):
6162
json = data
6263
data = {}
6364

64-
response = getattr(requests, method)( # call method dynamically https://stackoverflow.com/a/4246075/2299554
65+
response = requests.request( # call method dynamically https://stackoverflow.com/a/4246075/2299554
66+
method=method,
6567
url=self._endpoint + path,
6668
params=params,
6769
data=data,
6870
json=json,
69-
headers=headers,
71+
headers=self._global_headers,
7072
verify=self._self_signed,
7173
)
7274

73-
return response
75+
response.raise_for_status()
76+
77+
return response.json()

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
requests==2.22.0

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
setuptools.setup(
44
name = 'appwrite',
55
packages = ['appwrite', 'appwrite/services'],
6-
version = '0.0.2',
6+
version = '0.0.3',
77
license='BSD-3-Clause',
88
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)',
99
author = 'Appwrite Team',
1010
author_email = 'team@appwrite.io',
1111
maintainer = 'Appwrite Team',
1212
maintainer_email = 'team@appwrite.io',
1313
url = 'https://appwrite.io/support',
14-
download_url='https://github.com/appwrite/sdk-for-python/archive/0.0.2.tar.gz',
14+
download_url='https://github.com/appwrite/sdk-for-python/archive/0.0.3.tar.gz',
1515
# keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'],
1616
install_requires=[
1717
'requests',

0 commit comments

Comments
 (0)