ha-sdk-python 1.0.10__py3-none-any.whl

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 (237) hide show
  1. ha_sdk_python/__init__.py +490 -0
  2. ha_sdk_python/api/__init__.py +15 -0
  3. ha_sdk_python/api/backups_api.py +2434 -0
  4. ha_sdk_python/api/console_access_api.py +334 -0
  5. ha_sdk_python/api/dns_api.py +896 -0
  6. ha_sdk_python/api/firewall_api.py +1534 -0
  7. ha_sdk_python/api/monitoring_api.py +1234 -0
  8. ha_sdk_python/api/power_management_api.py +2434 -0
  9. ha_sdk_python/api/security_api.py +1243 -0
  10. ha_sdk_python/api/service_management_api.py +1797 -0
  11. ha_sdk_python/api/snapshots_api.py +1534 -0
  12. ha_sdk_python/api/user_management_api.py +331 -0
  13. ha_sdk_python/api/vps_management_api.py +2399 -0
  14. ha_sdk_python/api_client.py +805 -0
  15. ha_sdk_python/api_response.py +21 -0
  16. ha_sdk_python/configuration.py +593 -0
  17. ha_sdk_python/exceptions.py +218 -0
  18. ha_sdk_python/models/__init__.py +227 -0
  19. ha_sdk_python/models/backup_create_response_data.py +97 -0
  20. ha_sdk_python/models/backup_creation_info.py +95 -0
  21. ha_sdk_python/models/backup_item.py +95 -0
  22. ha_sdk_python/models/backup_mode.py +89 -0
  23. ha_sdk_python/models/backup_mode_type.py +38 -0
  24. ha_sdk_python/models/backup_schedule.py +98 -0
  25. ha_sdk_python/models/backup_schedule_list_response_data.py +97 -0
  26. ha_sdk_python/models/bad_request_error_response_content.py +89 -0
  27. ha_sdk_python/models/billing_cycle.py +37 -0
  28. ha_sdk_python/models/cancel_vps_request_content.py +90 -0
  29. ha_sdk_python/models/cancel_vps_response_content.py +94 -0
  30. ha_sdk_python/models/catalogue_config_option.py +105 -0
  31. ha_sdk_python/models/catalogue_config_suboption.py +96 -0
  32. ha_sdk_python/models/catalogue_currency.py +91 -0
  33. ha_sdk_python/models/catalogue_data.py +107 -0
  34. ha_sdk_python/models/catalogue_group.py +99 -0
  35. ha_sdk_python/models/catalogue_plan.py +108 -0
  36. ha_sdk_python/models/catalogue_product.py +131 -0
  37. ha_sdk_python/models/change_password_request_content.py +90 -0
  38. ha_sdk_python/models/change_password_response_content.py +94 -0
  39. ha_sdk_python/models/compression_method.py +89 -0
  40. ha_sdk_python/models/compression_type.py +39 -0
  41. ha_sdk_python/models/create_backup_request_content.py +93 -0
  42. ha_sdk_python/models/create_backup_response_content.py +94 -0
  43. ha_sdk_python/models/create_backup_schedule_request_content.py +108 -0
  44. ha_sdk_python/models/create_backup_schedule_response_content.py +94 -0
  45. ha_sdk_python/models/create_firewall_rule_request_content.py +115 -0
  46. ha_sdk_python/models/create_firewall_rule_response_content.py +94 -0
  47. ha_sdk_python/models/create_notification_request_content.py +111 -0
  48. ha_sdk_python/models/create_notification_response_content.py +94 -0
  49. ha_sdk_python/models/create_order_domain_item.py +101 -0
  50. ha_sdk_python/models/create_order_items.py +105 -0
  51. ha_sdk_python/models/create_order_product.py +108 -0
  52. ha_sdk_python/models/create_order_product_item.py +101 -0
  53. ha_sdk_python/models/create_order_request_content.py +97 -0
  54. ha_sdk_python/models/create_order_response_content.py +94 -0
  55. ha_sdk_python/models/create_order_response_data.py +126 -0
  56. ha_sdk_python/models/create_order_total.py +91 -0
  57. ha_sdk_python/models/create_power_task_request_content.py +160 -0
  58. ha_sdk_python/models/create_power_task_response_content.py +94 -0
  59. ha_sdk_python/models/create_rdns_record_request_content.py +96 -0
  60. ha_sdk_python/models/create_rdns_record_response_content.py +94 -0
  61. ha_sdk_python/models/create_rdns_record_response_data.py +91 -0
  62. ha_sdk_python/models/create_snapshot_request_content.py +91 -0
  63. ha_sdk_python/models/create_snapshot_response_content.py +94 -0
  64. ha_sdk_python/models/day_of_week.py +42 -0
  65. ha_sdk_python/models/delete_backup_request_content.py +89 -0
  66. ha_sdk_python/models/delete_backup_response_content.py +94 -0
  67. ha_sdk_python/models/delete_backup_schedule_request_content.py +89 -0
  68. ha_sdk_python/models/delete_backup_schedule_response_content.py +94 -0
  69. ha_sdk_python/models/delete_firewall_rule_request_content.py +89 -0
  70. ha_sdk_python/models/delete_firewall_rule_response_content.py +94 -0
  71. ha_sdk_python/models/delete_notification_request_content.py +89 -0
  72. ha_sdk_python/models/delete_notification_response_content.py +94 -0
  73. ha_sdk_python/models/delete_power_task_request_content.py +89 -0
  74. ha_sdk_python/models/delete_power_task_response_content.py +94 -0
  75. ha_sdk_python/models/delete_rdns_record_request_content.py +88 -0
  76. ha_sdk_python/models/delete_rdns_record_response_content.py +94 -0
  77. ha_sdk_python/models/delete_snapshot_request_content.py +89 -0
  78. ha_sdk_python/models/delete_snapshot_response_content.py +94 -0
  79. ha_sdk_python/models/edit_backup_schedule_request_content.py +110 -0
  80. ha_sdk_python/models/edit_backup_schedule_response_content.py +94 -0
  81. ha_sdk_python/models/firewall_list_response_data.py +125 -0
  82. ha_sdk_python/models/firewall_move_direction.py +39 -0
  83. ha_sdk_python/models/firewall_move_response_data.py +91 -0
  84. ha_sdk_python/models/firewall_option.py +89 -0
  85. ha_sdk_python/models/firewall_rule.py +113 -0
  86. ha_sdk_python/models/firewall_rule_action.py +38 -0
  87. ha_sdk_python/models/firewall_rule_type.py +38 -0
  88. ha_sdk_python/models/forbidden_error_response_content.py +89 -0
  89. ha_sdk_python/models/get_catalogue_request_content.py +89 -0
  90. ha_sdk_python/models/get_catalogue_response_content.py +94 -0
  91. ha_sdk_python/models/get_no_vnc_console_request_content.py +87 -0
  92. ha_sdk_python/models/get_no_vnc_console_response_content.py +94 -0
  93. ha_sdk_python/models/get_private_ssh_key_request_content.py +87 -0
  94. ha_sdk_python/models/get_private_ssh_key_response_content.py +94 -0
  95. ha_sdk_python/models/get_public_ssh_key_request_content.py +87 -0
  96. ha_sdk_python/models/get_public_ssh_key_response_content.py +94 -0
  97. ha_sdk_python/models/get_vps_config_request_content.py +87 -0
  98. ha_sdk_python/models/get_vps_config_response_content.py +94 -0
  99. ha_sdk_python/models/get_vps_details_request_content.py +87 -0
  100. ha_sdk_python/models/get_vps_details_response_content.py +94 -0
  101. ha_sdk_python/models/internal_service_error_response_content.py +89 -0
  102. ha_sdk_python/models/invalid_state_error_response_content.py +89 -0
  103. ha_sdk_python/models/list_backup_schedules_request_content.py +87 -0
  104. ha_sdk_python/models/list_backup_schedules_response_content.py +94 -0
  105. ha_sdk_python/models/list_backups_request_content.py +87 -0
  106. ha_sdk_python/models/list_backups_response_content.py +94 -0
  107. ha_sdk_python/models/list_firewall_rules_request_content.py +87 -0
  108. ha_sdk_python/models/list_firewall_rules_response_content.py +94 -0
  109. ha_sdk_python/models/list_isos_request_content.py +87 -0
  110. ha_sdk_python/models/list_isos_response_content.py +94 -0
  111. ha_sdk_python/models/list_isos_response_data.py +89 -0
  112. ha_sdk_python/models/list_notifications_request_content.py +87 -0
  113. ha_sdk_python/models/list_notifications_response_content.py +94 -0
  114. ha_sdk_python/models/list_orders_response_content.py +94 -0
  115. ha_sdk_python/models/list_orders_response_data.py +95 -0
  116. ha_sdk_python/models/list_power_tasks_request_content.py +87 -0
  117. ha_sdk_python/models/list_power_tasks_response_content.py +94 -0
  118. ha_sdk_python/models/list_rdns_records_response_content.py +94 -0
  119. ha_sdk_python/models/list_rdns_response_data.py +115 -0
  120. ha_sdk_python/models/list_reinstall_os_request_content.py +87 -0
  121. ha_sdk_python/models/list_reinstall_os_response_content.py +94 -0
  122. ha_sdk_python/models/list_reinstall_os_response_data.py +89 -0
  123. ha_sdk_python/models/list_snapshots_request_content.py +87 -0
  124. ha_sdk_python/models/list_snapshots_response_content.py +94 -0
  125. ha_sdk_python/models/list_vps_services_data.py +95 -0
  126. ha_sdk_python/models/list_vps_services_response_content.py +94 -0
  127. ha_sdk_python/models/mount_iso_request_content.py +91 -0
  128. ha_sdk_python/models/mount_iso_response_content.py +94 -0
  129. ha_sdk_python/models/move_firewall_rule_request_content.py +94 -0
  130. ha_sdk_python/models/move_firewall_rule_response_content.py +94 -0
  131. ha_sdk_python/models/no_vnc_console_details.py +95 -0
  132. ha_sdk_python/models/no_vnc_console_response_data.py +93 -0
  133. ha_sdk_python/models/notification.py +105 -0
  134. ha_sdk_python/models/notification_create_response_data.py +93 -0
  135. ha_sdk_python/models/notification_dialog_rules.py +95 -0
  136. ha_sdk_python/models/notification_list_response_data.py +103 -0
  137. ha_sdk_python/models/notification_status.py +43 -0
  138. ha_sdk_python/models/operation_status.py +37 -0
  139. ha_sdk_python/models/order.py +109 -0
  140. ha_sdk_python/models/order_last_attempt.py +93 -0
  141. ha_sdk_python/models/order_warning.py +89 -0
  142. ha_sdk_python/models/payment_error.py +89 -0
  143. ha_sdk_python/models/payment_status.py +38 -0
  144. ha_sdk_python/models/power_task.py +105 -0
  145. ha_sdk_python/models/power_task_action.py +38 -0
  146. ha_sdk_python/models/power_task_create_response_data.py +93 -0
  147. ha_sdk_python/models/power_task_dialog_rules.py +95 -0
  148. ha_sdk_python/models/power_task_job_type.py +38 -0
  149. ha_sdk_python/models/power_task_list_response_data.py +107 -0
  150. ha_sdk_python/models/public_ssh_key_response_data.py +93 -0
  151. ha_sdk_python/models/rdns_available_item.py +111 -0
  152. ha_sdk_python/models/rdns_pool.py +89 -0
  153. ha_sdk_python/models/rdns_record.py +109 -0
  154. ha_sdk_python/models/reboot_vps_request_content.py +87 -0
  155. ha_sdk_python/models/reboot_vps_response_content.py +94 -0
  156. ha_sdk_python/models/resource_not_found_error_response_content.py +89 -0
  157. ha_sdk_python/models/restore_backup_request_content.py +89 -0
  158. ha_sdk_python/models/restore_backup_response_content.py +94 -0
  159. ha_sdk_python/models/retry_payment_request_content.py +89 -0
  160. ha_sdk_python/models/retry_payment_response_content.py +94 -0
  161. ha_sdk_python/models/retry_payment_response_data.py +98 -0
  162. ha_sdk_python/models/retry_payment_total.py +91 -0
  163. ha_sdk_python/models/rollback_snapshot_request_content.py +89 -0
  164. ha_sdk_python/models/rollback_snapshot_response_content.py +94 -0
  165. ha_sdk_python/models/service_backups_response_data.py +131 -0
  166. ha_sdk_python/models/service_snapshots_response_data.py +101 -0
  167. ha_sdk_python/models/service_unavailable_error_response_content.py +89 -0
  168. ha_sdk_python/models/shutdown_vps_request_content.py +87 -0
  169. ha_sdk_python/models/shutdown_vps_response_content.py +94 -0
  170. ha_sdk_python/models/snapshot_create_response_data.py +89 -0
  171. ha_sdk_python/models/snapshot_item.py +95 -0
  172. ha_sdk_python/models/ssh_key_details.py +89 -0
  173. ha_sdk_python/models/start_vps_request_content.py +87 -0
  174. ha_sdk_python/models/start_vps_response_content.py +94 -0
  175. ha_sdk_python/models/stop_vps_request_content.py +87 -0
  176. ha_sdk_python/models/stop_vps_response_content.py +94 -0
  177. ha_sdk_python/models/too_many_requests_error_response_content.py +89 -0
  178. ha_sdk_python/models/trigger_reinstall_request_content.py +89 -0
  179. ha_sdk_python/models/trigger_reinstall_response_content.py +94 -0
  180. ha_sdk_python/models/trigger_reinstall_response_data.py +89 -0
  181. ha_sdk_python/models/unauthorized_error_response_content.py +89 -0
  182. ha_sdk_python/models/update_firewall_rule_request_content.py +94 -0
  183. ha_sdk_python/models/update_firewall_rule_response_content.py +94 -0
  184. ha_sdk_python/models/update_notification_request_content.py +113 -0
  185. ha_sdk_python/models/update_notification_response_content.py +94 -0
  186. ha_sdk_python/models/update_power_task_request_content.py +164 -0
  187. ha_sdk_python/models/update_power_task_response_content.py +94 -0
  188. ha_sdk_python/models/update_snapshot_request_content.py +91 -0
  189. ha_sdk_python/models/update_snapshot_response_content.py +94 -0
  190. ha_sdk_python/models/update_ssh_keys_request_content.py +97 -0
  191. ha_sdk_python/models/update_ssh_keys_response_content.py +94 -0
  192. ha_sdk_python/models/update_vps_config_request_content.py +99 -0
  193. ha_sdk_python/models/update_vps_config_response_content.py +94 -0
  194. ha_sdk_python/models/user_change_password_details.py +91 -0
  195. ha_sdk_python/models/user_change_password_request_content.py +92 -0
  196. ha_sdk_python/models/user_change_password_response_content.py +94 -0
  197. ha_sdk_python/models/user_change_password_response_data.py +95 -0
  198. ha_sdk_python/models/validate_pricing_base.py +89 -0
  199. ha_sdk_python/models/validate_pricing_breakdown.py +103 -0
  200. ha_sdk_python/models/validate_pricing_config_item.py +116 -0
  201. ha_sdk_python/models/validate_pricing_currency.py +93 -0
  202. ha_sdk_python/models/validate_pricing_discount.py +97 -0
  203. ha_sdk_python/models/validate_pricing_plan_config.py +97 -0
  204. ha_sdk_python/models/validate_pricing_plan_pricing.py +89 -0
  205. ha_sdk_python/models/validate_pricing_price_range.py +91 -0
  206. ha_sdk_python/models/validate_pricing_product.py +101 -0
  207. ha_sdk_python/models/validate_pricing_product_result.py +121 -0
  208. ha_sdk_python/models/validate_pricing_prorata.py +95 -0
  209. ha_sdk_python/models/validate_pricing_request_content.py +97 -0
  210. ha_sdk_python/models/validate_pricing_response_content.py +94 -0
  211. ha_sdk_python/models/validate_pricing_response_data.py +109 -0
  212. ha_sdk_python/models/validate_pricing_summary.py +101 -0
  213. ha_sdk_python/models/validate_pricing_summary_recurring.py +91 -0
  214. ha_sdk_python/models/validation_error_response_content.py +89 -0
  215. ha_sdk_python/models/vps_available_features.py +115 -0
  216. ha_sdk_python/models/vps_bandwidth_info.py +94 -0
  217. ha_sdk_python/models/vps_cancel_response_data.py +93 -0
  218. ha_sdk_python/models/vps_cancel_type.py +37 -0
  219. ha_sdk_python/models/vps_config_response_data.py +108 -0
  220. ha_sdk_python/models/vps_cpu_info.py +92 -0
  221. ha_sdk_python/models/vps_credentials.py +89 -0
  222. ha_sdk_python/models/vps_details_response.py +143 -0
  223. ha_sdk_python/models/vps_disk_info.py +96 -0
  224. ha_sdk_python/models/vps_memory_info.py +96 -0
  225. ha_sdk_python/models/vps_network_rate.py +92 -0
  226. ha_sdk_python/models/vps_os_info.py +89 -0
  227. ha_sdk_python/models/vps_service_info.py +97 -0
  228. ha_sdk_python/models/vps_simple_action_response_data.py +87 -0
  229. ha_sdk_python/models/vps_vm_info.py +102 -0
  230. ha_sdk_python/py.typed +0 -0
  231. ha_sdk_python/rest.py +263 -0
  232. ha_sdk_python/retryable_paths.py +26 -0
  233. ha_sdk_python-1.0.10.dist-info/METADATA +131 -0
  234. ha_sdk_python-1.0.10.dist-info/RECORD +237 -0
  235. ha_sdk_python-1.0.10.dist-info/WHEEL +5 -0
  236. ha_sdk_python-1.0.10.dist-info/licenses/LICENSE +21 -0
  237. ha_sdk_python-1.0.10.dist-info/top_level.txt +1 -0
ha_sdk_python/rest.py ADDED
@@ -0,0 +1,263 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ HostAfricaApi
5
+
6
+ HostAfrica API
7
+
8
+ The version of the OpenAPI document: 2026-01-01
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ import io
16
+ import json
17
+ import re
18
+ import ssl
19
+
20
+ import urllib3
21
+
22
+ from ha_sdk_python.exceptions import ApiException, ApiValueError
23
+
24
+ SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
25
+ RESTResponseType = urllib3.HTTPResponse
26
+
27
+
28
+ def is_socks_proxy_url(url):
29
+ if url is None:
30
+ return False
31
+ split_section = url.split("://")
32
+ if len(split_section) < 2:
33
+ return False
34
+ else:
35
+ return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES
36
+
37
+
38
+ class RESTResponse(io.IOBase):
39
+
40
+ def __init__(self, resp) -> None:
41
+ self.response = resp
42
+ self.status = resp.status
43
+ self.reason = resp.reason
44
+ self.data = None
45
+
46
+ def read(self):
47
+ if self.data is None:
48
+ self.data = self.response.data
49
+ return self.data
50
+
51
+ @property
52
+ def headers(self):
53
+ """Returns a dictionary of response headers."""
54
+ return self.response.headers
55
+
56
+ def getheaders(self):
57
+ """Returns a dictionary of the response headers; use ``headers`` instead."""
58
+ return self.response.headers
59
+
60
+ def getheader(self, name, default=None):
61
+ """Returns a given response header; use ``headers.get()`` instead."""
62
+ return self.response.headers.get(name, default)
63
+
64
+
65
+ class RESTClientObject:
66
+
67
+ def __init__(self, configuration) -> None:
68
+ # urllib3.PoolManager will pass all kw parameters to connectionpool
69
+ # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
70
+ # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
71
+ # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
72
+
73
+ # cert_reqs
74
+ if configuration.verify_ssl:
75
+ cert_reqs = ssl.CERT_REQUIRED
76
+ else:
77
+ cert_reqs = ssl.CERT_NONE
78
+
79
+ pool_args = {
80
+ "cert_reqs": cert_reqs,
81
+ "ca_certs": configuration.ssl_ca_cert,
82
+ "cert_file": configuration.cert_file,
83
+ "key_file": configuration.key_file,
84
+ "ca_cert_data": configuration.ca_cert_data,
85
+ }
86
+ if configuration.assert_hostname is not None:
87
+ pool_args['assert_hostname'] = (
88
+ configuration.assert_hostname
89
+ )
90
+
91
+ if configuration.retries is not None:
92
+ pool_args['retries'] = configuration.retries
93
+
94
+ if configuration.tls_server_name:
95
+ pool_args['server_hostname'] = configuration.tls_server_name
96
+
97
+
98
+ if configuration.socket_options is not None:
99
+ pool_args['socket_options'] = configuration.socket_options
100
+
101
+ if configuration.connection_pool_maxsize is not None:
102
+ pool_args['maxsize'] = configuration.connection_pool_maxsize
103
+
104
+ # https pool manager
105
+ self.pool_manager: urllib3.PoolManager
106
+
107
+ if configuration.proxy:
108
+ if is_socks_proxy_url(configuration.proxy):
109
+ from urllib3.contrib.socks import SOCKSProxyManager
110
+ pool_args["proxy_url"] = configuration.proxy
111
+ pool_args["headers"] = configuration.proxy_headers
112
+ self.pool_manager = SOCKSProxyManager(**pool_args)
113
+ else:
114
+ pool_args["proxy_url"] = configuration.proxy
115
+ pool_args["proxy_headers"] = configuration.proxy_headers
116
+ self.pool_manager = urllib3.ProxyManager(**pool_args)
117
+ else:
118
+ self.pool_manager = urllib3.PoolManager(**pool_args)
119
+
120
+ def request(
121
+ self,
122
+ method,
123
+ url,
124
+ headers=None,
125
+ body=None,
126
+ post_params=None,
127
+ _request_timeout=None
128
+ ):
129
+ """Perform requests.
130
+
131
+ :param method: http request method
132
+ :param url: http request url
133
+ :param headers: http request headers
134
+ :param body: request json body, for `application/json`
135
+ :param post_params: request post parameters,
136
+ `application/x-www-form-urlencoded`
137
+ and `multipart/form-data`
138
+ :param _request_timeout: timeout setting for this request. If one
139
+ number provided, it will be total request
140
+ timeout. It can also be a pair (tuple) of
141
+ (connection, read) timeouts.
142
+ """
143
+ method = method.upper()
144
+ assert method in [
145
+ 'GET',
146
+ 'HEAD',
147
+ 'DELETE',
148
+ 'POST',
149
+ 'PUT',
150
+ 'PATCH',
151
+ 'OPTIONS'
152
+ ]
153
+
154
+ if post_params and body:
155
+ raise ApiValueError(
156
+ "body parameter cannot be used with post_params parameter."
157
+ )
158
+
159
+ post_params = post_params or {}
160
+ headers = headers or {}
161
+
162
+ timeout = None
163
+ if _request_timeout:
164
+ if isinstance(_request_timeout, (int, float)):
165
+ timeout = urllib3.Timeout(total=_request_timeout)
166
+ elif (
167
+ isinstance(_request_timeout, tuple)
168
+ and len(_request_timeout) == 2
169
+ ):
170
+ timeout = urllib3.Timeout(
171
+ connect=_request_timeout[0],
172
+ read=_request_timeout[1]
173
+ )
174
+
175
+ try:
176
+ # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
177
+ if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
178
+
179
+ # no content type provided or payload is json
180
+ content_type = headers.get('Content-Type')
181
+ if (
182
+ not content_type
183
+ or re.search('json', content_type, re.IGNORECASE)
184
+ ):
185
+ request_body = None
186
+ if body is not None:
187
+ request_body = json.dumps(body)
188
+ r = self.pool_manager.request(
189
+ method,
190
+ url,
191
+ body=request_body,
192
+ timeout=timeout,
193
+ headers=headers,
194
+ preload_content=False
195
+ )
196
+ elif content_type == 'application/x-www-form-urlencoded':
197
+ r = self.pool_manager.request(
198
+ method,
199
+ url,
200
+ fields=post_params,
201
+ encode_multipart=False,
202
+ timeout=timeout,
203
+ headers=headers,
204
+ preload_content=False
205
+ )
206
+ elif content_type == 'multipart/form-data':
207
+ # must del headers['Content-Type'], or the correct
208
+ # Content-Type which generated by urllib3 will be
209
+ # overwritten.
210
+ del headers['Content-Type']
211
+ # Ensures that dict objects are serialized
212
+ post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params]
213
+ r = self.pool_manager.request(
214
+ method,
215
+ url,
216
+ fields=post_params,
217
+ encode_multipart=True,
218
+ timeout=timeout,
219
+ headers=headers,
220
+ preload_content=False
221
+ )
222
+ # Pass a `string` parameter directly in the body to support
223
+ # other content types than JSON when `body` argument is
224
+ # provided in serialized form.
225
+ elif isinstance(body, str) or isinstance(body, bytes):
226
+ r = self.pool_manager.request(
227
+ method,
228
+ url,
229
+ body=body,
230
+ timeout=timeout,
231
+ headers=headers,
232
+ preload_content=False
233
+ )
234
+ elif headers['Content-Type'].startswith('text/') and isinstance(body, bool):
235
+ request_body = "true" if body else "false"
236
+ r = self.pool_manager.request(
237
+ method,
238
+ url,
239
+ body=request_body,
240
+ preload_content=False,
241
+ timeout=timeout,
242
+ headers=headers)
243
+ else:
244
+ # Cannot generate the request from given parameters
245
+ msg = """Cannot prepare a request message for provided
246
+ arguments. Please check that your arguments match
247
+ declared content type."""
248
+ raise ApiException(status=0, reason=msg)
249
+ # For `GET`, `HEAD`
250
+ else:
251
+ r = self.pool_manager.request(
252
+ method,
253
+ url,
254
+ fields={},
255
+ timeout=timeout,
256
+ headers=headers,
257
+ preload_content=False
258
+ )
259
+ except urllib3.exceptions.SSLError as e:
260
+ msg = "\n".join([type(e).__name__, str(e)])
261
+ raise ApiException(status=0, reason=msg)
262
+
263
+ return RESTResponse(r)
@@ -0,0 +1,26 @@
1
+ # AUTO-GENERATED — do not edit manually.
2
+ # Re-run `make sdk-python` (or `make sdk-all`) to update.
3
+ # Source of truth: @readonly annotations in hostafrica-api.smithy
4
+
5
+ from typing import FrozenSet
6
+
7
+ RETRYABLE_PATHS: FrozenSet[str] = frozenset({
8
+ "/vps/list-vps-services",
9
+ "/vps/get-details",
10
+ "/vps/get-config",
11
+ "/vps/novnc-console",
12
+ "/vps/list-backups",
13
+ "/vps/list-backup-schedules",
14
+ "/vps/list-snapshots",
15
+ "/vps/list-firewall-rules",
16
+ "/vps/get-public-ssh-keys",
17
+ "/vps/get-private-ssh-keys",
18
+ "/vps/list-power-tasks",
19
+ "/vps/list-notifications",
20
+ "/vps/list-isos",
21
+ "/vps/list-reinstall-images",
22
+ "/vps/get-catalogue",
23
+ "/vps/validate-pricing",
24
+ "/vps/list-orders",
25
+ "/dns/list-rdns-records",
26
+ })
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: ha-sdk-python
3
+ Version: 1.0.10
4
+ Summary: Python SDK for the HostAfrica API
5
+ Author-email: HostAfrica <support@hostafrica.com>
6
+ Project-URL: Repository, https://github.com/hostafrica/ha-sdk-python
7
+ Keywords: hostafrica,vps,cloud,sdk,api
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: urllib3<3.0.0,>=2.1.0
12
+ Requires-Dist: python-dateutil>=2.8.2
13
+ Requires-Dist: pydantic<3,>=2
14
+ Requires-Dist: typing-extensions>=4.7.1
15
+ Provides-Extra: dev
16
+ Requires-Dist: pytest>=7.2.1; extra == "dev"
17
+ Requires-Dist: pytest-cov>=2.8.1; extra == "dev"
18
+ Requires-Dist: tox>=3.9.0; extra == "dev"
19
+ Requires-Dist: flake8>=4.0.0; extra == "dev"
20
+ Requires-Dist: types-python-dateutil>=2.8.19.14; extra == "dev"
21
+ Requires-Dist: mypy>=1.5; extra == "dev"
22
+ Dynamic: license-file
23
+
24
+ # ha-sdk-python
25
+
26
+ A Python SDK client for the api.hostafrica.com API.
27
+
28
+ This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
29
+
30
+ ## Requirements.
31
+
32
+ Python 3.9+
33
+
34
+ ## Installation & Usage
35
+ ### pip install
36
+
37
+ If the python package is hosted on a repository, you can install directly using:
38
+
39
+ ```sh
40
+ pip install git+https://github.com/hostafrica/ha-sdk-python.git
41
+ ```
42
+ (you may need to run `pip` with root permission: `sudo pip install git+https://github.com/hostafrica/ha-sdk-python.git`)
43
+
44
+ Then import the package:
45
+ ```python
46
+ import ha_sdk_python
47
+ ```
48
+
49
+ ### Setuptools
50
+
51
+ Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
52
+
53
+ ```sh
54
+ python setup.py install --user
55
+ ```
56
+ (or `sudo python setup.py install` to install the package for all users)
57
+
58
+ Then import the package:
59
+ ```python
60
+ import ha_sdk_python
61
+ ```
62
+
63
+ ### Tests
64
+
65
+ Execute `pytest` to run the tests.
66
+
67
+ ## Getting Started
68
+
69
+ Please follow the [installation procedure](#installation--usage) and then run the following:
70
+
71
+ ```python
72
+
73
+ import ha_sdk_python
74
+ from ha_sdk_python.rest import ApiException
75
+ from pprint import pprint
76
+
77
+ # Defining the host is optional and defaults to https://api.hostafrica.com
78
+ # See configuration.py for a list of all supported configuration parameters.
79
+ configuration = ha_sdk_python.Configuration(
80
+ host = "https://api.hostafrica.com"
81
+ )
82
+
83
+ # The client must configure the authentication and authorization parameters
84
+ # in accordance with the API server security policy.
85
+ # Examples for each auth method are provided below, use the example that
86
+ # satisfies your auth use case.
87
+
88
+ # Configure Bearer authorization: BearerAuth
89
+ configuration = ha_sdk_python.Configuration(
90
+ access_token = os.environ["BEARER_TOKEN"]
91
+ )
92
+
93
+
94
+ # Enter a context with an instance of the API client
95
+ with ha_sdk_python.ApiClient(configuration) as api_client:
96
+ # Create an instance of the API class
97
+ api_instance = ha_sdk_python.BackupsApi(api_client)
98
+ create_backup_request_content = ha_sdk_python.CreateBackupRequestContent() # CreateBackupRequestContent |
99
+
100
+ try:
101
+ api_response = api_instance.create_backup(create_backup_request_content)
102
+ print("The response of BackupsApi->create_backup:\n")
103
+ pprint(api_response)
104
+ except ApiException as e:
105
+ print("Exception when calling BackupsApi->create_backup: %s\n" % e)
106
+
107
+ ```
108
+
109
+ ## Documentation
110
+
111
+ [**API Reference Documentation**](https://api.hostafrica.com)
112
+
113
+ [**Documentation per api/operation**](docs/)
114
+
115
+
116
+ <a id="documentation-for-authorization"></a>
117
+ ## Documentation For Authorization
118
+
119
+
120
+ Authentication schemes defined for the API:
121
+
122
+ <a id="BearerAuth"></a>
123
+ ### BearerAuth
124
+
125
+ - **Type**: Bearer authentication
126
+
127
+
128
+
129
+
130
+
131
+