Skip to content

Commit a0b01d0

Browse files
author
YangSen-qn
committed
resume up api version default to v2
1 parent e86ef98 commit a0b01d0

File tree

12 files changed

+333
-74
lines changed

12 files changed

+333
-74
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
*.py[cod]
66

7+
tests/cases/env
78
my-test-env.sh
89

910
##

examples/upload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# flake8: noqa
33
# import hashlib
44

5-
from qiniu import Auth, put_file, urlsafe_base64_encode
5+
from qiniu import Auth, put_file_v2, urlsafe_base64_encode
66
import qiniu.config
77
from qiniu.compat import is_py2, is_py3
88

@@ -37,7 +37,7 @@
3737
# 'x-qn-meta-md5': hasher.hexdigest()
3838
# }
3939

40-
ret, info = put_file(
40+
ret, info = put_file_v2(
4141
token,
4242
key,
4343
localfile

examples/upload_callback.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
# flake8: noqa
33

4-
from qiniu import Auth, put_file
4+
from qiniu import Auth, put_file_v2
55

66
access_key = '...'
77
secret_key = '...'
@@ -22,6 +22,6 @@
2222

2323
localfile = './sync/bbb.jpg'
2424

25-
ret, info = put_file(token, key, localfile)
25+
ret, info = put_file_v2(token, key, localfile)
2626
print(info)
2727
assert ret['key'] == key

examples/upload_pfops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
# flake8: noqa
3-
from qiniu import Auth, put_file, urlsafe_base64_encode
3+
from qiniu import Auth, urlsafe_base64_encode, put_file_v2
44

55
access_key = '...'
66
secret_key = '...'
@@ -33,6 +33,6 @@
3333

3434
localfile = './python_video.flv'
3535

36-
ret, info = put_file(token, key, localfile)
36+
ret, info = put_file_v2(token, key, localfile)
3737
print(info)
3838
assert ret['key'] == key

examples/upload_with_qvmzone.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
# flake8: noqa
33

4-
from qiniu import Auth, put_file, urlsafe_base64_encode
4+
from qiniu import Auth, put_file_v2
55
import qiniu.config
66
from qiniu import Zone, set_default
77

@@ -34,6 +34,6 @@
3434
scheme='http')
3535
set_default(default_zone=zone)
3636

37-
ret, info = put_file(token, key, localfile)
37+
ret, info = put_file_v2(token, key, localfile)
3838
print(info)
3939
assert ret['key'] == key

examples/upload_with_zone.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
# flake8: noqa
33

4-
from qiniu import Auth, put_file
4+
from qiniu import Auth, put_file_v2
55
from qiniu import Zone, set_default
66

77
# 需要填写你的 Access Key 和 Secret Key
@@ -38,5 +38,5 @@
3838
scheme='https')
3939
set_default(default_zone=zone)
4040

41-
ret, info = put_file(token, key, localfile)
41+
ret, info = put_file_v2(token, key, localfile)
4242
print(info)

qiniu/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from .services.storage.bucket import BucketManager, build_batch_copy, build_batch_rename, build_batch_move, \
2121
build_batch_stat, build_batch_delete, build_batch_restoreAr, build_batch_restore_ar
22-
from .services.storage.uploader import put_data, put_file, put_stream
22+
from .services.storage.uploader import put_data, put_file, put_file_v2, put_stream, put_stream_v2
2323
from .services.storage.upload_progress_recorder import UploadProgressRecorder
2424
from .services.cdn.manager import CdnManager, DataType, create_timestamp_anti_leech_url, DomainManager
2525
from .services.processing.pfop import PersistentFop

qiniu/services/storage/legacy.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
import os
44
import time
55

6+
from typing_extensions import deprecated
7+
68
from qiniu import config, http
79
from qiniu.auth import Auth
810
from qiniu.compat import json
911
from qiniu.utils import _file_iter, crc32, rfc_from_timestamp, urlsafe_base64_encode
1012

1113
from qiniu.services.storage.upload_progress_recorder import UploadProgressRecorder
1214

13-
15+
@deprecated("use uploader instead")
1416
class _Resume(object):
1517
"""deprecated 断点续上传类
1618

0 commit comments

Comments
 (0)