Skip to content

Commit 44f31b0

Browse files
YangSen-qnYangSen-qn
andauthored
Features/resume default v2 (#463)
* resume up api version default to v2 * version to 7.17.0 * ci: platform ubuntu-20.04 -> ubuntu-22.04 * ci: windows-2019 -> windows-2022 --------- Co-authored-by: YangSen-qn <[email protected]>
1 parent e86ef98 commit 44f31b0

File tree

16 files changed

+358
-85
lines changed

16 files changed

+358
-85
lines changed

.github/workflows/ci-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
max-parallel: 1
88
matrix:
99
python_version: ['2.7', '3.4', '3.5', '3.6', '3.7', '3.8', '3.9']
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
1111
steps:
1212
- name: Checkout repo
1313
uses: actions/checkout@v2
@@ -84,7 +84,7 @@ jobs:
8484
max-parallel: 1
8585
matrix:
8686
python_version: ['2.7', '3.5', '3.9']
87-
runs-on: windows-2019
87+
runs-on: windows-2022
8888
# make sure only one test running,
8989
# remove this when cases could run in parallel.
9090
needs: test

.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
##

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Changelog
2+
## 7.17.0
3+
* 对象存储,分片上传默认使用 V2 接口
4+
25
## 7.16.0
36
* 对象存储,优化并发场景的区域查询
47
* CDN,查询域名带宽,支持 `data_type` 参数

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# flake8: noqa
1111

12-
__version__ = '7.16.0'
12+
__version__ = '7.17.0'
1313

1414
from .auth import Auth, QiniuMacAuth
1515

@@ -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/http/regions_provider.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ def __init__(self, fd):
161161

162162
def __enter__(self):
163163
with _file_threading_lockers_lock:
164-
global _file_threading_lockers
165164
threading_lock = _file_threading_lockers.get(self._file_path, threading.Lock())
166165
# Could use keyword style `acquire(blocking=False)` when min version of python update to >= 3
167166
if not threading_lock.acquire(False):
@@ -170,7 +169,6 @@ def __enter__(self):
170169

171170
def __exit__(self, exc_type, exc_val, exc_tb):
172171
with _file_threading_lockers_lock:
173-
global _file_threading_lockers
174172
threading_lock = _file_threading_lockers.get(self._file_path)
175173
if threading_lock and threading_lock.locked():
176174
threading_lock.release()

0 commit comments

Comments
 (0)