byteplus-python-sdk-v2 1.0.2__tar.gz → 1.0.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.
Files changed (67) hide show
  1. {byteplus-python-sdk-v2-1.0.2/byteplus_python_sdk_v2.egg-info → byteplus-python-sdk-v2-1.0.3}/PKG-INFO +1 -1
  2. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3/byteplus_python_sdk_v2.egg-info}/PKG-INFO +1 -1
  3. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplus_python_sdk_v2.egg-info/SOURCES.txt +1 -0
  4. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkcore/api_client.py +10 -4
  5. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkcore/configuration.py +3 -3
  6. byteplus-python-sdk-v2-1.0.3/byteplussdkcore/endpoint.py +32 -0
  7. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/setup.py +1 -1
  8. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/LICENSE.txt +0 -0
  9. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/NOTICE.md +0 -0
  10. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/README.md +0 -0
  11. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplus_python_sdk_v2.egg-info/dependency_links.txt +0 -0
  12. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplus_python_sdk_v2.egg-info/requires.txt +0 -0
  13. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplus_python_sdk_v2.egg-info/top_level.txt +0 -0
  14. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/__init__.py +0 -0
  15. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/api/__init__.py +0 -0
  16. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/api/billing_api.py +0 -0
  17. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/__init__.py +0 -0
  18. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/auth_for_list_invitation_output.py +0 -0
  19. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/auth_info_for_list_financial_relation_output.py +0 -0
  20. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/auth_info_for_list_invitation_output.py +0 -0
  21. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/base_for_list_bill_detail_input.py +0 -0
  22. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/base_for_list_bill_overview_by_category_input.py +0 -0
  23. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/base_for_list_bill_overview_by_prod_input.py +0 -0
  24. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/cancel_invitation_request.py +0 -0
  25. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/cancel_invitation_response.py +0 -0
  26. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/convert_list_for_list_bill_overview_by_category_output.py +0 -0
  27. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/create_financial_relation_request.py +0 -0
  28. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/create_financial_relation_response.py +0 -0
  29. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/delete_financial_relation_request.py +0 -0
  30. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/delete_financial_relation_response.py +0 -0
  31. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/handle_invitation_request.py +0 -0
  32. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/handle_invitation_response.py +0 -0
  33. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/instance_list_for_list_available_instances_output.py +0 -0
  34. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_available_instances_request.py +0 -0
  35. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_available_instances_response.py +0 -0
  36. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_bill_detail_request.py +0 -0
  37. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_bill_detail_response.py +0 -0
  38. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_bill_overview_by_category_request.py +0 -0
  39. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_bill_overview_by_category_response.py +0 -0
  40. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_bill_overview_by_prod_request.py +0 -0
  41. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_bill_overview_by_prod_response.py +0 -0
  42. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_financial_relation_request.py +0 -0
  43. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_financial_relation_response.py +0 -0
  44. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_for_list_bill_detail_output.py +0 -0
  45. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_for_list_bill_overview_by_category_output.py +0 -0
  46. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_for_list_bill_overview_by_prod_output.py +0 -0
  47. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_for_list_financial_relation_output.py +0 -0
  48. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_for_list_invitation_output.py +0 -0
  49. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_for_list_split_bill_detail_output.py +0 -0
  50. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_invitation_request.py +0 -0
  51. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_invitation_response.py +0 -0
  52. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_split_bill_detail_request.py +0 -0
  53. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/list_split_bill_detail_response.py +0 -0
  54. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/relation_for_list_invitation_output.py +0 -0
  55. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/success_instance_info_for_unsubscribe_instance_output.py +0 -0
  56. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/traffic_env_for_list_bill_detail_input.py +0 -0
  57. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/traffic_env_for_list_bill_overview_by_category_input.py +0 -0
  58. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/traffic_env_for_list_bill_overview_by_prod_input.py +0 -0
  59. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/unsubscribe_instance_request.py +0 -0
  60. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkbilling/models/unsubscribe_instance_response.py +0 -0
  61. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkcore/__init__.py +0 -0
  62. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkcore/flatten.py +0 -0
  63. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkcore/metadata.py +0 -0
  64. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkcore/rest.py +0 -0
  65. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkcore/signv4.py +0 -0
  66. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/byteplussdkcore/universal.py +0 -0
  67. {byteplus-python-sdk-v2-1.0.2 → byteplus-python-sdk-v2-1.0.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: byteplus-python-sdk-v2
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: Byteplus SDK for Python
5
5
  Home-page: UNKNOWN
6
6
  Author: UNKNOWN
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: byteplus-python-sdk-v2
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: Byteplus SDK for Python
5
5
  Home-page: UNKNOWN
6
6
  Author: UNKNOWN
@@ -57,6 +57,7 @@ byteplussdkbilling/models/unsubscribe_instance_response.py
57
57
  byteplussdkcore/__init__.py
58
58
  byteplussdkcore/api_client.py
59
59
  byteplussdkcore/configuration.py
60
+ byteplussdkcore/endpoint.py
60
61
  byteplussdkcore/flatten.py
61
62
  byteplussdkcore/metadata.py
62
63
  byteplussdkcore/rest.py
@@ -19,6 +19,7 @@ from byteplussdkcore.configuration import Configuration
19
19
  from byteplussdkcore import rest
20
20
  from byteplussdkcore.metadata import ResponseMetadata
21
21
  from byteplussdkcore.signv4 import SignerV4
22
+ from byteplussdkcore.endpoint import DefaultEndpointResolver
22
23
 
23
24
 
24
25
  class ApiClient(object):
@@ -67,7 +68,7 @@ class ApiClient(object):
67
68
  self.default_headers[header_name] = header_value
68
69
  self.cookie = cookie
69
70
  # Set default User-Agent.
70
- self.user_agent = 'byteplus-python-sdk-v2/1.0.2'
71
+ self.user_agent = 'byteplus-python-sdk-v2/1.0.3'
71
72
  self.client_side_validation = configuration.client_side_validation
72
73
 
73
74
  def __del__(self):
@@ -170,15 +171,20 @@ class ApiClient(object):
170
171
 
171
172
  true_path = "/"
172
173
  service = resource_path.split("/")[3]
174
+ host = ""
175
+ if len(self.configuration.host) > 0:
176
+ host = self.configuration.host
177
+ else:
178
+ host = DefaultEndpointResolver.get_default_endpoint_by_service_info(service, self.configuration.region)
173
179
 
174
180
  # auth setting
175
181
  # notice: change query_params from tuple to dict
176
- self.update_params_for_auth(host=self.configuration.host, path=true_path, method=method,
182
+ self.update_params_for_auth(host=host, path=true_path, method=method,
177
183
  headers=header_params, querys=query_params,
178
184
  auth_settings=auth_settings, body=body, service=service)
179
185
 
180
186
  # request url
181
- url = self.configuration.schema + "://" + self.configuration.host + true_path
187
+ url = self.configuration.schema + "://" + host + true_path
182
188
 
183
189
  # perform request and return response
184
190
  response_data = self.request(
@@ -646,7 +652,7 @@ class ApiClient(object):
646
652
  status=0,
647
653
  reason=(
648
654
  "Failed to parse `{0}` as datetime object"
649
- .format(string)
655
+ .format(string)
650
656
  )
651
657
  )
652
658
 
@@ -34,9 +34,9 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
34
34
 
35
35
  def __init__(self):
36
36
  # Default Base url
37
- self.host = "open.byteplusapi.com"
37
+ self.host = ""
38
38
  # Schema Support http or https
39
- self.schema = "http"
39
+ self.schema = "https"
40
40
  # Temp file folder for downloading files
41
41
  self.temp_folder_path = None
42
42
 
@@ -219,5 +219,5 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
219
219
  "OS: {env}\n"\
220
220
  "Python Version: {pyversion}\n"\
221
221
  "Version of the API: 0.1.0\n"\
222
- "SDK Package Version: 1.0.2".\
222
+ "SDK Package Version: 1.0.3".\
223
223
  format(env=sys.platform, pyversion=sys.version)
@@ -0,0 +1,32 @@
1
+ class ServiceEndpointInfo(object):
2
+ def __init__(self, service_name, is_global, global_endpoint, default_endpoint, region_endpoint_map):
3
+ self.service_name = service_name
4
+ self.is_global = is_global
5
+ self.global_endpoint = global_endpoint
6
+ self.default_endpoint = default_endpoint
7
+ self.region_endpoint_map = region_endpoint_map
8
+
9
+
10
+ class DefaultEndpointResolver(object):
11
+ global_endpoint = "open.ap-southeast-1.byteplusapi.com"
12
+ default_endpoint_map = {
13
+ "billing": ServiceEndpointInfo("billing",
14
+ True,
15
+ "",
16
+ "open.byteplusapi.com",
17
+ None)
18
+ }
19
+
20
+ @staticmethod
21
+ def get_default_endpoint_by_service_info(service, region):
22
+ if service in DefaultEndpointResolver.default_endpoint_map:
23
+ service_endpoint_info = DefaultEndpointResolver.default_endpoint_map[service]
24
+ if service_endpoint_info.is_global:
25
+ if len(service_endpoint_info.global_endpoint) > 0:
26
+ return service_endpoint_info.global_endpoint
27
+ else:
28
+ if service_endpoint_info.region_endpoint_map is not None and region in service_endpoint_info.region_endpoint_map:
29
+ return service_endpoint_info.region_endpoint_map[region]
30
+ if service_endpoint_info.default_endpoint is not None and len(service_endpoint_info.default_endpoint) > 0:
31
+ return service_endpoint_info.default_endpoint
32
+ return DefaultEndpointResolver.global_endpoint
@@ -3,7 +3,7 @@
3
3
  from setuptools import setup, find_packages # noqa: H301
4
4
 
5
5
  NAME = "byteplus-python-sdk-v2"
6
- VERSION = "1.0.2"
6
+ VERSION = "1.0.3"
7
7
  # To install the library, run the following
8
8
  #
9
9
  # python setup.py install