Skip to content

Commit e76dd15

Browse files
Merge pull request #32 from appwrite/dev
feat: update version
2 parents eb09f64 + d4d8830 commit e76dd15

File tree

10 files changed

+83
-19
lines changed

10 files changed

+83
-19
lines changed

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# Appwrite Python SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-0.8.0-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-0.9.0-blue.svg?style=flat-square)
5+
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
56
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io)
67
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
78

8-
**This SDK is compatible with Appwrite server version 0.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).**
9+
**This SDK is compatible with Appwrite server version 0.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).**
910

10-
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.
11-
Use the Python SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
12-
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
11+
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. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
1312

1413
![Appwrite](https://appwrite.io/images/github.png)
1514

@@ -25,7 +24,7 @@ pip install appwrite
2524
## Getting Started
2625

2726
### Init your SDK
28-
Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from project's API keys section.
27+
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page and your new API secret Key from project's API keys section.
2928

3029
```python
3130
from appwrite.client import Client
@@ -42,7 +41,7 @@ client = Client()
4241
```
4342

4443
### Make Your First Request
45-
Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section.
44+
Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.
4645

4746
```python
4847
users = Users(client)
@@ -81,7 +80,7 @@ except AppwriteException as e:
8180
```
8281

8382
### Learn more
84-
You can use followng resources to learn more and get help
83+
You can use following resources to learn more and get help
8584
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
8685
- 📜 [Appwrite Docs](https://appwrite.io/docs)
8786
- 💬 [Discord Community](https://appwrite.io/discord)

appwrite/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ def __init__(self):
88
self._endpoint = 'https://appwrite.io/v1'
99
self._global_headers = {
1010
'content-type': '',
11-
'x-sdk-version': 'appwrite:python:0.3.0',
12-
'X-Appwrite-Response-Format' : '0.8.0',
11+
'x-sdk-version': 'appwrite:python:0.4.0',
12+
'X-Appwrite-Response-Format' : '0.9.0',
1313
}
1414

1515
def set_self_signed(self, status=True):

appwrite/services/account.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,20 @@ def delete_sessions(self):
195195
'content-type': 'application/json',
196196
}, params)
197197

198+
def get_session(self, session_id):
199+
"""Get Session By ID"""
200+
201+
if session_id is None:
202+
raise AppwriteException('Missing required parameter: "session_id"')
203+
204+
params = {}
205+
path = '/account/sessions/{sessionId}'
206+
path = path.replace('{sessionId}', session_id)
207+
208+
return self.client.call('get', path, {
209+
'content-type': 'application/json',
210+
}, params)
211+
198212
def delete_session(self, session_id):
199213
"""Delete Account Session"""
200214

appwrite/services/functions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def list(self, search = None, limit = None, offset = None, order_type = None):
2828
'content-type': 'application/json',
2929
}, params)
3030

31-
def create(self, name, execute, env, vars = None, events = None, schedule = None, timeout = None):
31+
def create(self, name, execute, runtime, vars = None, events = None, schedule = None, timeout = None):
3232
"""Create Function"""
3333

3434
if name is None:
@@ -37,8 +37,8 @@ def create(self, name, execute, env, vars = None, events = None, schedule = None
3737
if execute is None:
3838
raise AppwriteException('Missing required parameter: "execute"')
3939

40-
if env is None:
41-
raise AppwriteException('Missing required parameter: "env"')
40+
if runtime is None:
41+
raise AppwriteException('Missing required parameter: "runtime"')
4242

4343
params = {}
4444
path = '/functions'
@@ -49,8 +49,8 @@ def create(self, name, execute, env, vars = None, events = None, schedule = None
4949
if execute is not None:
5050
params['execute'] = execute
5151

52-
if env is not None:
53-
params['env'] = env
52+
if runtime is not None:
53+
params['runtime'] = runtime
5454

5555
if vars is not None:
5656
params['vars'] = vars

appwrite/services/storage.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def get_file_download(self, file_id):
118118
'content-type': 'application/json',
119119
}, params)
120120

121-
def get_file_preview(self, file_id, width = None, height = None, quality = None, border_width = None, border_color = None, border_radius = None, opacity = None, rotation = None, background = None, output = None):
121+
def get_file_preview(self, file_id, width = None, height = None, gravity = None, quality = None, border_width = None, border_color = None, border_radius = None, opacity = None, rotation = None, background = None, output = None):
122122
"""Get File Preview"""
123123

124124
if file_id is None:
@@ -134,6 +134,9 @@ def get_file_preview(self, file_id, width = None, height = None, quality = None,
134134
if height is not None:
135135
params['height'] = height
136136

137+
if gravity is not None:
138+
params['gravity'] = gravity
139+
137140
if quality is not None:
138141
params['quality'] = quality
139142

appwrite/services/users.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,23 @@ def update_status(self, user_id, status):
194194
return self.client.call('patch', path, {
195195
'content-type': 'application/json',
196196
}, params)
197+
198+
def update_verification(self, user_id, email_verification):
199+
"""Update Email Verification"""
200+
201+
if user_id is None:
202+
raise AppwriteException('Missing required parameter: "user_id"')
203+
204+
if email_verification is None:
205+
raise AppwriteException('Missing required parameter: "email_verification"')
206+
207+
params = {}
208+
path = '/users/{userId}/verification'
209+
path = path.replace('{userId}', user_id)
210+
211+
if email_verification is not None:
212+
params['emailVerification'] = email_verification
213+
214+
return self.client.call('patch', path, {
215+
'content-type': 'application/json',
216+
}, params)

docs/examples/account/get-session.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from appwrite.client import Client
2+
from appwrite.services.account import Account
3+
4+
client = Client()
5+
6+
(client
7+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
8+
.set_project('5df5acd0d48c2') # Your project ID
9+
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
10+
)
11+
12+
account = Account(client)
13+
14+
result = account.get_session('[SESSION_ID]')

docs/examples/functions/create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ client = Client()
1111

1212
functions = Functions(client)
1313

14-
result = functions.create('[NAME]', [], 'dotnet-3.1')
14+
result = functions.create('[NAME]', [], 'java-11.0')
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from appwrite.client import Client
2+
from appwrite.services.users import Users
3+
4+
client = Client()
5+
6+
(client
7+
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
8+
.set_project('5df5acd0d48c2') # Your project ID
9+
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
10+
)
11+
12+
users = Users(client)
13+
14+
result = users.update_verification('[USER_ID]', False)

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.3.0',
6+
version = '0.4.0',
77
license='BSD-3-Clause',
88
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',
99
author = 'Appwrite Team',
1010
author_email = '[email protected]',
1111
maintainer = 'Appwrite Team',
1212
maintainer_email = '[email protected]',
1313
url = 'https://appwrite.io/support',
14-
download_url='https://github.com/appwrite/sdk-for-python/archive/0.3.0.tar.gz',
14+
download_url='https://github.com/appwrite/sdk-for-python/archive/0.4.0.tar.gz',
1515
# keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'],
1616
install_requires=[
1717
'requests',

0 commit comments

Comments
 (0)