Skip to content

Commit 8c5d500

Browse files
author
yuniszhang
committed
解决requests和certifi组件不兼容python老版本问题
1 parent accb2da commit 8c5d500

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

qcloud_cos/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '5.1.9.18'
1+
__version__ = '5.1.9.19'

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
certifi<=2021.10.8;python_version<'3.0' # certifi新版本不支持python2,这里需要使用低版本
2-
requests>=2.8
31
dicttoxml
42
six
53
crcmod

setup.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1+
# -*- coding: utf-8 -*-
2+
13
from setuptools import setup, find_packages
24
from platform import python_version_tuple
35
import io
6+
import sys
47

58

69
def requirements():
710
with open('requirements.txt', 'r') as fileobj:
8-
requirements = [line.strip() for line in fileobj]
11+
requirements = []
12+
13+
# certifi2021.10.8之后的版本不再支持python2和python3.6之前的版本
14+
if sys.version_info.major < 3 or \
15+
(sys.version_info.major == 3 and sys.version_info.minor < 6):
16+
requirements.append('certifi<=2021.10.8')
17+
18+
# requests2.27.1之后的版本不再支持python2和python3.7之前的版本
19+
if sys.version_info.major < 3 or \
20+
(sys.version_info.major == 3 and sys.version_info.minor < 7):
21+
requirements.append('requests>=2.8,<=2.27.1')
22+
else:
23+
requirements.append('requests>=2.8')
24+
25+
requirements.extend([line.strip() for line in fileobj])
926
return requirements
1027

1128

@@ -16,7 +33,7 @@ def long_description():
1633

1734
setup(
1835
name='cos-python-sdk-v5',
19-
version='1.9.18',
36+
version='1.9.19',
2037
url='https://www.qcloud.com/',
2138
license='MIT',
2239
author='tiedu, lewzylu, channingliu',

0 commit comments

Comments
 (0)