Skip to content

Commit fcf238a

Browse files
committed
fix: update qiniu dependency
close #521
1 parent e609f9b commit fcf238a

File tree

3 files changed

+3
-25
lines changed

3 files changed

+3
-25
lines changed

leancloud/file_.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -184,36 +184,14 @@ def destroy(self):
184184
if response.status_code != 200:
185185
raise LeanCloudError(1, "the file is not sucessfully destroyed")
186186

187-
def _save_to_qiniu_internal_py3(self, token, key):
188-
from qiniu.services.storage.uploader import crc32, _form_put
189-
from qiniu.config import _BLOCK_SIZE
190-
191-
final_data = ""
192-
while True:
193-
tmp_data = self._source.read(_BLOCK_SIZE)
194-
if len(tmp_data) == 0:
195-
break
196-
elif len(final_data) == 0:
197-
final_data = tmp_data
198-
else:
199-
final_data += tmp_data
200-
201-
crc = crc32(final_data)
202-
return _form_put(token, key, final_data, None, self.mime_type, crc)
203187

204188
def _save_to_qiniu(self, token, key):
205189
self._source.seek(0)
206190

207191
import qiniu
208192

209193
qiniu.set_default(connection_timeout=self.timeout)
210-
211-
if six.PY3:
212-
# use patched put_data implementation for py3k
213-
ret, info = self._save_to_qiniu_internal_py3(token, key)
214-
else:
215-
# use put_data implementation provided by qiniu-sdk
216-
ret, info = qiniu.put_data(token, key, self._source)
194+
ret, info = qiniu.put_data(token, key, self._source)
217195
self._source.seek(0)
218196

219197
if info.status_code != 200:

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ arrow>=0.17.0,<1.0.0; python_version < '3.6'
22
arrow>=1.0.0,<2.0.0; python_version >= '3.6'
33
iso8601>=0.1.14
44
six>=1.11.0
5-
qiniu>=7.1.4,<7.2.4
5+
qiniu>=7.3.1
66
requests>=2.25.1
77
Werkzeug>=0.16.0,<2.0.0
88
secure-cookie>=0.1.0,<1.0.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"arrow>=1.0.0,<2.0.0; python_version >= '3.6'",
1111
'iso8601>=0.1.14',
1212
'six>=1.11.0',
13-
'qiniu>=7.1.4,<7.2.4',
13+
'qiniu==7.3.1',
1414
'requests>=2.25.1',
1515
'Werkzeug>=0.16.0,<2.0.0',
1616
'secure-cookie>=0.1.0,<1.0.0',

0 commit comments

Comments
 (0)