Skip to content

Commit 33e173b

Browse files
authoredJan 29, 2025
Merge pull request #102 from appwrite/dev
fix: pong response & chunked upload
2 parents 6ca2104 + 3f190c8 commit 33e173b

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed
 

Diff for: ‎appwrite/client.py

+13-15
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ def __init__(self):
1313
self._endpoint = 'https://cloud.appwrite.io/v1'
1414
self._global_headers = {
1515
'content-type': '',
16-
'user-agent' : 'AppwritePythonSDK/7.1.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
16+
'user-agent' : 'AppwritePythonSDK/8.0.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
1717
'x-sdk-name': 'Python',
1818
'x-sdk-platform': 'server',
1919
'x-sdk-language': 'python',
20-
'x-sdk-version': '7.1.0',
20+
'x-sdk-version': '8.0.0',
2121
'X-Appwrite-Response-Format' : '1.6.0',
2222
}
2323

@@ -79,7 +79,7 @@ def call(self, method, path='', headers=None, params=None, response_type='json')
7979
data = {}
8080
files = {}
8181
stringify = False
82-
82+
8383
headers = {**self._global_headers, **headers}
8484

8585
if method != 'get':
@@ -170,12 +170,11 @@ def chunked_upload(
170170
offset = 0
171171
counter = 0
172172

173-
if upload_id != 'unique()':
174-
try:
175-
result = self.call('get', path + '/' + upload_id, headers)
176-
counter = result['chunksUploaded']
177-
except:
178-
pass
173+
try:
174+
result = self.call('get', path + '/' + upload_id, headers)
175+
counter = result['chunksUploaded']
176+
except:
177+
pass
179178

180179
if counter > 0:
181180
offset = counter * self._chunk_size
@@ -188,7 +187,7 @@ def chunked_upload(
188187
if offset + self._chunk_size < size:
189188
end = offset + self._chunk_size
190189
else:
191-
end = size - offset
190+
end = size
192191
input_file.data = input[offset:end]
193192

194193
params[param_name] = input_file
@@ -200,10 +199,10 @@ def chunked_upload(
200199
headers,
201200
params,
202201
)
203-
202+
204203
offset = offset + self._chunk_size
205-
206-
if "$id" in result:
204+
205+
if "$id" in result:
207206
headers["x-appwrite-id"] = result["$id"]
208207

209208
if on_progress is not None:
@@ -229,7 +228,7 @@ def flatten(self, data, prefix='', stringify=False):
229228
finalKey = prefix + '[' + key +']' if prefix else key
230229
finalKey = prefix + '[' + str(i) +']' if isinstance(data, list) else finalKey
231230
i += 1
232-
231+
233232
if isinstance(value, list) or isinstance(value, dict):
234233
output = {**output, **self.flatten(value, finalKey, stringify)}
235234
else:
@@ -239,4 +238,3 @@ def flatten(self, data, prefix='', stringify=False):
239238
output[finalKey] = value
240239

241240
return output
242-

Diff for: ‎appwrite/enums/image_format.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ class ImageFormat(Enum):
66
GIF = "gif"
77
PNG = "png"
88
WEBP = "webp"
9+
HEIC = "heic"
910
AVIF = "avif"

Diff for: ‎setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'appwrite/encoders',
1414
'appwrite/enums',
1515
],
16-
version = '7.1.0',
16+
version = '8.0.0'
1717
license='BSD-3-Clause',
1818
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',
1919
long_description = long_description,
@@ -23,7 +23,7 @@
2323
maintainer = 'Appwrite Team',
2424
maintainer_email = 'team@appwrite.io',
2525
url = 'https://appwrite.io/support',
26-
download_url='https://github.com/appwrite/sdk-for-python/archive/7.1.0.tar.gz',
26+
download_url='https://github.com/appwrite/sdk-for-python/archive/8.0.0.tar.gz',
2727
install_requires=[
2828
'requests',
2929
],

0 commit comments

Comments
 (0)