Skip to content

feat: update version #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Appwrite Python SDK

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

**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).**
**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).**

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)
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)

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

Expand All @@ -25,7 +24,7 @@ pip install appwrite
## Getting Started

### Init your SDK
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.
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.

```python
from appwrite.client import Client
Expand All @@ -42,7 +41,7 @@ client = Client()
```

### Make Your First Request
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.
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.

```python
users = Users(client)
Expand Down Expand Up @@ -81,7 +80,7 @@ except AppwriteException as e:
```

### Learn more
You can use followng resources to learn more and get help
You can use following resources to learn more and get help
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
- 📜 [Appwrite Docs](https://appwrite.io/docs)
- 💬 [Discord Community](https://appwrite.io/discord)
Expand Down
4 changes: 2 additions & 2 deletions appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ def __init__(self):
self._endpoint = 'https://appwrite.io/v1'
self._global_headers = {
'content-type': '',
'x-sdk-version': 'appwrite:python:0.3.0',
'X-Appwrite-Response-Format' : '0.8.0',
'x-sdk-version': 'appwrite:python:0.4.0',
'X-Appwrite-Response-Format' : '0.9.0',
}

def set_self_signed(self, status=True):
Expand Down
14 changes: 14 additions & 0 deletions appwrite/services/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,20 @@ def delete_sessions(self):
'content-type': 'application/json',
}, params)

def get_session(self, session_id):
"""Get Session By ID"""

if session_id is None:
raise AppwriteException('Missing required parameter: "session_id"')

params = {}
path = '/account/sessions/{sessionId}'
path = path.replace('{sessionId}', session_id)

return self.client.call('get', path, {
'content-type': 'application/json',
}, params)

def delete_session(self, session_id):
"""Delete Account Session"""

Expand Down
10 changes: 5 additions & 5 deletions appwrite/services/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def list(self, search = None, limit = None, offset = None, order_type = None):
'content-type': 'application/json',
}, params)

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

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

if env is None:
raise AppwriteException('Missing required parameter: "env"')
if runtime is None:
raise AppwriteException('Missing required parameter: "runtime"')

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

if env is not None:
params['env'] = env
if runtime is not None:
params['runtime'] = runtime

if vars is not None:
params['vars'] = vars
Expand Down
5 changes: 4 additions & 1 deletion appwrite/services/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def get_file_download(self, file_id):
'content-type': 'application/json',
}, params)

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):
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):
"""Get File Preview"""

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

if gravity is not None:
params['gravity'] = gravity

if quality is not None:
params['quality'] = quality

Expand Down
20 changes: 20 additions & 0 deletions appwrite/services/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,23 @@ def update_status(self, user_id, status):
return self.client.call('patch', path, {
'content-type': 'application/json',
}, params)

def update_verification(self, user_id, email_verification):
"""Update Email Verification"""

if user_id is None:
raise AppwriteException('Missing required parameter: "user_id"')

if email_verification is None:
raise AppwriteException('Missing required parameter: "email_verification"')

params = {}
path = '/users/{userId}/verification'
path = path.replace('{userId}', user_id)

if email_verification is not None:
params['emailVerification'] = email_verification

return self.client.call('patch', path, {
'content-type': 'application/json',
}, params)
14 changes: 14 additions & 0 deletions docs/examples/account/get-session.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()

(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
)

account = Account(client)

result = account.get_session('[SESSION_ID]')
2 changes: 1 addition & 1 deletion docs/examples/functions/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ client = Client()

functions = Functions(client)

result = functions.create('[NAME]', [], 'dotnet-3.1')
result = functions.create('[NAME]', [], 'java-11.0')
14 changes: 14 additions & 0 deletions docs/examples/users/update-verification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from appwrite.client import Client
from appwrite.services.users import Users

client = Client()

(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)

users = Users(client)

result = users.update_verification('[USER_ID]', False)
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
setuptools.setup(
name = 'appwrite',
packages = ['appwrite', 'appwrite/services'],
version = '0.3.0',
version = '0.4.0',
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',
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.3.0.tar.gz',
download_url='https://github.com/appwrite/sdk-for-python/archive/0.4.0.tar.gz',
# keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'],
install_requires=[
'requests',
Expand Down