@@ -13,11 +13,11 @@ def __init__(self):
13
13
self ._endpoint = 'https://cloud.appwrite.io/v1'
14
14
self ._global_headers = {
15
15
'content-type' : '' ,
16
- 'user-agent' : 'AppwritePythonSDK/6.2.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})' ,
16
+ 'user-agent' : 'AppwritePythonSDK/7.1.1 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})' ,
17
17
'x-sdk-name' : 'Python' ,
18
18
'x-sdk-platform' : 'server' ,
19
19
'x-sdk-language' : 'python' ,
20
- 'x-sdk-version' : '6.2.0 ' ,
20
+ 'x-sdk-version' : '7.1.1 ' ,
21
21
'X-Appwrite-Response-Format' : '1.6.0' ,
22
22
}
23
23
@@ -79,7 +79,7 @@ def call(self, method, path='', headers=None, params=None, response_type='json')
79
79
data = {}
80
80
files = {}
81
81
stringify = False
82
-
82
+
83
83
headers = {** self ._global_headers , ** headers }
84
84
85
85
if method != 'get' :
@@ -170,12 +170,11 @@ def chunked_upload(
170
170
offset = 0
171
171
counter = 0
172
172
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
179
178
180
179
if counter > 0 :
181
180
offset = counter * self ._chunk_size
@@ -188,7 +187,7 @@ def chunked_upload(
188
187
if offset + self ._chunk_size < size :
189
188
end = offset + self ._chunk_size
190
189
else :
191
- end = size - offset
190
+ end = size
192
191
input_file .data = input [offset :end ]
193
192
194
193
params [param_name ] = input_file
@@ -200,10 +199,10 @@ def chunked_upload(
200
199
headers ,
201
200
params ,
202
201
)
203
-
202
+
204
203
offset = offset + self ._chunk_size
205
-
206
- if "$id" in result :
204
+
205
+ if "$id" in result :
207
206
headers ["x-appwrite-id" ] = result ["$id" ]
208
207
209
208
if on_progress is not None :
@@ -229,7 +228,7 @@ def flatten(self, data, prefix='', stringify=False):
229
228
finalKey = prefix + '[' + key + ']' if prefix else key
230
229
finalKey = prefix + '[' + str (i ) + ']' if isinstance (data , list ) else finalKey
231
230
i += 1
232
-
231
+
233
232
if isinstance (value , list ) or isinstance (value , dict ):
234
233
output = {** output , ** self .flatten (value , finalKey , stringify )}
235
234
else :
@@ -239,4 +238,3 @@ def flatten(self, data, prefix='', stringify=False):
239
238
output [finalKey ] = value
240
239
241
240
return output
242
-
0 commit comments