tencentcloud-sdk-python-common 3.0.1410__tar.gz → 3.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tencentcloud_sdk_python_common-3.1.3/PKG-INFO +48 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/setup.py +1 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/__init__.py +1 -1
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/abstract_client.py +14 -12
- tencentcloud_sdk_python_common-3.1.3/tencentcloud/common/abstract_client_async.py +654 -0
- tencentcloud_sdk_python_common-3.1.3/tencentcloud/common/common_client_async.py +45 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/credential.py +81 -28
- tencentcloud_sdk_python_common-3.1.3/tencentcloud/common/http/request_async.py +62 -0
- tencentcloud_sdk_python_common-3.1.3/tencentcloud/common/retry_async.py +87 -0
- tencentcloud_sdk_python_common-3.1.3/tencentcloud_sdk_python_common.egg-info/PKG-INFO +48 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud_sdk_python_common.egg-info/SOURCES.txt +4 -0
- tencentcloud_sdk_python_common-3.1.3/tencentcloud_sdk_python_common.egg-info/requires.txt +4 -0
- tencentcloud-sdk-python-common-3.0.1410/PKG-INFO +0 -45
- tencentcloud-sdk-python-common-3.0.1410/tencentcloud_sdk_python_common.egg-info/PKG-INFO +0 -45
- tencentcloud-sdk-python-common-3.0.1410/tencentcloud_sdk_python_common.egg-info/requires.txt +0 -1
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/README.rst +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/setup.cfg +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/__init__.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/abstract_model.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/circuit_breaker.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/common_client.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/exception/__init__.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/exception/tencent_cloud_sdk_exception.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/http/__init__.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/http/pre_conn.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/http/request.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/profile/__init__.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/profile/client_profile.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/profile/http_profile.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/retry.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud/common/sign.py +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud_sdk_python_common.egg-info/dependency_links.txt +0 -0
- {tencentcloud-sdk-python-common-3.0.1410 → tencentcloud_sdk_python_common-3.1.3}/tencentcloud_sdk_python_common.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: tencentcloud-sdk-python-common
|
|
3
|
+
Version: 3.1.3
|
|
4
|
+
Summary: Tencent Cloud Common SDK for Python
|
|
5
|
+
Home-page: https://github.com/TencentCloud/tencentcloud-sdk-python
|
|
6
|
+
Author: Tencent Cloud
|
|
7
|
+
Maintainer-email: tencentcloudapi@tencent.com
|
|
8
|
+
License: Apache License 2.0
|
|
9
|
+
Platform: any
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python
|
|
14
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
18
|
+
Requires-Dist: requests>=2.16.0
|
|
19
|
+
Provides-Extra: async
|
|
20
|
+
Requires-Dist: httpx>=0.22.0; extra == "async"
|
|
21
|
+
|
|
22
|
+
============================
|
|
23
|
+
Tencent Cloud SDK for Python
|
|
24
|
+
============================
|
|
25
|
+
|
|
26
|
+
Tencent Cloud Python Common SDK is the official software development kit, which allows Python developers to write software that makes use of Tencent Cloud services like CVM and CBS.
|
|
27
|
+
The SDK works on Python versions:
|
|
28
|
+
|
|
29
|
+
* 2.7 and greater, including 3.x
|
|
30
|
+
|
|
31
|
+
Quick Start
|
|
32
|
+
-----------
|
|
33
|
+
|
|
34
|
+
First, install the library:
|
|
35
|
+
|
|
36
|
+
.. code-block:: sh
|
|
37
|
+
|
|
38
|
+
$ pip install tencentcloud-sdk-python-common
|
|
39
|
+
$ pip install tencentcloud-sdk-python-common
|
|
40
|
+
|
|
41
|
+
or download source code from github and install:
|
|
42
|
+
|
|
43
|
+
.. code-block:: sh
|
|
44
|
+
|
|
45
|
+
$ git clone https://github.com/tencentcloud/tencentcloud-sdk-python.git
|
|
46
|
+
$ cd tencentcloud-sdk-python
|
|
47
|
+
$ python package.py --components common common
|
|
48
|
+
|
|
@@ -9,6 +9,7 @@ ROOT = os.path.dirname(__file__)
|
|
|
9
9
|
setup(
|
|
10
10
|
name='tencentcloud-sdk-python-common',
|
|
11
11
|
install_requires=["requests>=2.16.0"],
|
|
12
|
+
extras_require={"async": ["httpx>=0.22.0"]},
|
|
12
13
|
version=tencentcloud.__version__,
|
|
13
14
|
description='Tencent Cloud Common SDK for Python',
|
|
14
15
|
long_description=open('README.rst').read(),
|
|
@@ -147,14 +147,16 @@ class AbstractClient(object):
|
|
|
147
147
|
params['Timestamp'] = int(time.time())
|
|
148
148
|
params['Version'] = self._apiVersion
|
|
149
149
|
|
|
150
|
+
cred_secret_id, cred_secret_key, cred_token = self.credential.get_credential_info()
|
|
151
|
+
|
|
150
152
|
if self.region:
|
|
151
153
|
params['Region'] = self.region
|
|
152
154
|
|
|
153
|
-
if
|
|
154
|
-
params['Token'] =
|
|
155
|
+
if cred_token:
|
|
156
|
+
params['Token'] = cred_token
|
|
155
157
|
|
|
156
|
-
if
|
|
157
|
-
params['SecretId'] =
|
|
158
|
+
if cred_secret_id:
|
|
159
|
+
params['SecretId'] = cred_secret_id
|
|
158
160
|
|
|
159
161
|
if self.profile.signMethod:
|
|
160
162
|
params['SignatureMethod'] = self.profile.signMethod
|
|
@@ -163,7 +165,7 @@ class AbstractClient(object):
|
|
|
163
165
|
params['Language'] = self.profile.language
|
|
164
166
|
|
|
165
167
|
signInParam = self._format_sign_string(params, options)
|
|
166
|
-
params['Signature'] = Sign.sign(str(
|
|
168
|
+
params['Signature'] = Sign.sign(str(cred_secret_key),
|
|
167
169
|
str(signInParam),
|
|
168
170
|
str(self.profile.signMethod))
|
|
169
171
|
|
|
@@ -189,6 +191,7 @@ class AbstractClient(object):
|
|
|
189
191
|
|
|
190
192
|
endpoint = self._get_endpoint(options=options)
|
|
191
193
|
timestamp = int(time.time())
|
|
194
|
+
cred_secret_id, cred_secret_key, cred_token = self.credential.get_credential_info()
|
|
192
195
|
req.header["Host"] = endpoint
|
|
193
196
|
req.header["X-TC-Action"] = action[0].upper() + action[1:]
|
|
194
197
|
req.header["X-TC-RequestClient"] = self.request_client
|
|
@@ -198,8 +201,8 @@ class AbstractClient(object):
|
|
|
198
201
|
req.header["X-TC-Content-SHA256"] = "UNSIGNED-PAYLOAD"
|
|
199
202
|
if self.region:
|
|
200
203
|
req.header['X-TC-Region'] = self.region
|
|
201
|
-
if
|
|
202
|
-
req.header['X-TC-Token'] =
|
|
204
|
+
if cred_token:
|
|
205
|
+
req.header['X-TC-Token'] = cred_token
|
|
203
206
|
if self.profile.language:
|
|
204
207
|
req.header['X-TC-Language'] = self.profile.language
|
|
205
208
|
|
|
@@ -215,13 +218,13 @@ class AbstractClient(object):
|
|
|
215
218
|
|
|
216
219
|
service = self._service
|
|
217
220
|
date = datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%d')
|
|
218
|
-
signature = self._get_tc3_signature(params, req, date, service, options)
|
|
221
|
+
signature = self._get_tc3_signature(params, req, date, service, cred_secret_key, options)
|
|
219
222
|
|
|
220
223
|
auth = "TC3-HMAC-SHA256 Credential=%s/%s/%s/tc3_request, SignedHeaders=content-type;host, Signature=%s" % (
|
|
221
|
-
|
|
224
|
+
cred_secret_id, date, service, signature)
|
|
222
225
|
req.header["Authorization"] = auth
|
|
223
226
|
|
|
224
|
-
def _get_tc3_signature(self, params, req, date, service, options=None):
|
|
227
|
+
def _get_tc3_signature(self, params, req, date, service, secret_key, options=None):
|
|
225
228
|
options = options or {}
|
|
226
229
|
canonical_uri = req.uri
|
|
227
230
|
canonical_querystring = ""
|
|
@@ -258,8 +261,7 @@ class AbstractClient(object):
|
|
|
258
261
|
req.header["X-TC-Timestamp"],
|
|
259
262
|
credential_scope,
|
|
260
263
|
digest)
|
|
261
|
-
|
|
262
|
-
return Sign.sign_tc3(self.credential.secret_key, date, service, string2sign)
|
|
264
|
+
return Sign.sign_tc3(secret_key, date, service, string2sign)
|
|
263
265
|
|
|
264
266
|
def _build_req_without_signature(self, action, params, req, options=None):
|
|
265
267
|
content_type = self._default_content_type
|