Skip to content

Commit 94e08f6

Browse files
authored
Merge pull request #118 from appwrite/dev
feat: Python SDK update for version 13.2.0
2 parents 61d36cf + 47dfc26 commit 94e08f6

13 files changed

+115
-5
lines changed

appwrite/client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
import os
44
import platform
5+
import sys
56
import requests
67
from .input_file import InputFile
78
from .exception import AppwriteException
@@ -14,11 +15,11 @@ def __init__(self):
1415
self._endpoint = 'https://cloud.appwrite.io/v1'
1516
self._global_headers = {
1617
'content-type': '',
17-
'user-agent' : f'AppwritePythonSDK/13.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
18+
'user-agent' : f'AppwritePythonSDK/13.2.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
1819
'x-sdk-name': 'Python',
1920
'x-sdk-platform': 'server',
2021
'x-sdk-language': 'python',
21-
'x-sdk-version': '13.1.0',
22+
'x-sdk-version': '13.2.0',
2223
'X-Appwrite-Response-Format' : '1.8.0',
2324
}
2425

@@ -120,7 +121,7 @@ def call(self, method, path='', headers=None, params=None, response_type='json')
120121
warnings = response.headers.get('x-appwrite-warning')
121122
if warnings:
122123
for warning in warnings.split(';'):
123-
print(f'Warning: {warning}')
124+
print(f'Warning: {warning}', file=sys.stderr)
124125

125126
content_type = response.headers['Content-Type']
126127

appwrite/encoders/value_class_encoder.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@
2323
from ..enums.image_format import ImageFormat
2424
from ..enums.password_hash import PasswordHash
2525
from ..enums.messaging_provider_type import MessagingProviderType
26+
from ..enums.database_type import DatabaseType
27+
from ..enums.attribute_status import AttributeStatus
28+
from ..enums.column_status import ColumnStatus
29+
from ..enums.index_status import IndexStatus
30+
from ..enums.deployment_status import DeploymentStatus
31+
from ..enums.execution_trigger import ExecutionTrigger
32+
from ..enums.execution_status import ExecutionStatus
33+
from ..enums.health_antivirus_status import HealthAntivirusStatus
34+
from ..enums.health_check_status import HealthCheckStatus
35+
from ..enums.message_status import MessageStatus
2636

2737
class ValueClassEncoder(json.JSONEncoder):
2838
def default(self, o):
@@ -98,4 +108,34 @@ def default(self, o):
98108
if isinstance(o, MessagingProviderType):
99109
return o.value
100110

111+
if isinstance(o, DatabaseType):
112+
return o.value
113+
114+
if isinstance(o, AttributeStatus):
115+
return o.value
116+
117+
if isinstance(o, ColumnStatus):
118+
return o.value
119+
120+
if isinstance(o, IndexStatus):
121+
return o.value
122+
123+
if isinstance(o, DeploymentStatus):
124+
return o.value
125+
126+
if isinstance(o, ExecutionTrigger):
127+
return o.value
128+
129+
if isinstance(o, ExecutionStatus):
130+
return o.value
131+
132+
if isinstance(o, HealthAntivirusStatus):
133+
return o.value
134+
135+
if isinstance(o, HealthCheckStatus):
136+
return o.value
137+
138+
if isinstance(o, MessageStatus):
139+
return o.value
140+
101141
return super().default(o)

appwrite/enums/attribute_status.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from enum import Enum
2+
3+
class AttributeStatus(Enum):
4+
AVAILABLE = "available"
5+
PROCESSING = "processing"
6+
DELETING = "deleting"
7+
STUCK = "stuck"
8+
FAILED = "failed"

appwrite/enums/column_status.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from enum import Enum
2+
3+
class ColumnStatus(Enum):
4+
AVAILABLE = "available"
5+
PROCESSING = "processing"
6+
DELETING = "deleting"
7+
STUCK = "stuck"
8+
FAILED = "failed"

appwrite/enums/database_type.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from enum import Enum
2+
3+
class DatabaseType(Enum):
4+
LEGACY = "legacy"
5+
TABLESDB = "tablesdb"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from enum import Enum
2+
3+
class DeploymentStatus(Enum):
4+
WAITING = "waiting"
5+
PROCESSING = "processing"
6+
BUILDING = "building"
7+
READY = "ready"
8+
FAILED = "failed"

appwrite/enums/execution_status.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from enum import Enum
2+
3+
class ExecutionStatus(Enum):
4+
WAITING = "waiting"
5+
PROCESSING = "processing"
6+
COMPLETED = "completed"
7+
FAILED = "failed"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from enum import Enum
2+
3+
class ExecutionTrigger(Enum):
4+
HTTP = "http"
5+
SCHEDULE = "schedule"
6+
EVENT = "event"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from enum import Enum
2+
3+
class HealthAntivirusStatus(Enum):
4+
DISABLED = "disabled"
5+
OFFLINE = "offline"
6+
ONLINE = "online"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from enum import Enum
2+
3+
class HealthCheckStatus(Enum):
4+
PASS = "pass"
5+
FAIL = "fail"

0 commit comments

Comments
 (0)