pluggy-sdk 1.0.0.post20__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 (213) hide show
  1. pluggy_sdk/__init__.py +220 -0
  2. pluggy_sdk/api/__init__.py +30 -0
  3. pluggy_sdk/api/account_api.py +588 -0
  4. pluggy_sdk/api/acquirer_anticipation_api.py +664 -0
  5. pluggy_sdk/api/acquirer_receivable_api.py +664 -0
  6. pluggy_sdk/api/acquirer_sale_api.py +664 -0
  7. pluggy_sdk/api/auth_api.py +605 -0
  8. pluggy_sdk/api/benefit_api.py +567 -0
  9. pluggy_sdk/api/bill_api.py +567 -0
  10. pluggy_sdk/api/bulk_payment_api.py +1127 -0
  11. pluggy_sdk/api/category_api.py +1096 -0
  12. pluggy_sdk/api/connector_api.py +979 -0
  13. pluggy_sdk/api/consent_api.py +576 -0
  14. pluggy_sdk/api/identity_api.py +581 -0
  15. pluggy_sdk/api/income_report_api.py +311 -0
  16. pluggy_sdk/api/investment_api.py +918 -0
  17. pluggy_sdk/api/items_api.py +1456 -0
  18. pluggy_sdk/api/loan_api.py +567 -0
  19. pluggy_sdk/api/payment_customer_api.py +1414 -0
  20. pluggy_sdk/api/payment_intent_api.py +842 -0
  21. pluggy_sdk/api/payment_receipts_api.py +842 -0
  22. pluggy_sdk/api/payment_recipient_api.py +1997 -0
  23. pluggy_sdk/api/payment_request_api.py +2739 -0
  24. pluggy_sdk/api/payment_schedule_api.py +823 -0
  25. pluggy_sdk/api/payroll_loan_api.py +561 -0
  26. pluggy_sdk/api/portfolio_yield_api.py +580 -0
  27. pluggy_sdk/api/smart_account_api.py +1704 -0
  28. pluggy_sdk/api/smart_account_transfer_api.py +610 -0
  29. pluggy_sdk/api/smart_transfer_api.py +1406 -0
  30. pluggy_sdk/api/transaction_api.py +963 -0
  31. pluggy_sdk/api/webhook_api.py +1406 -0
  32. pluggy_sdk/api_client.py +798 -0
  33. pluggy_sdk/api_response.py +21 -0
  34. pluggy_sdk/configuration.py +480 -0
  35. pluggy_sdk/exceptions.py +200 -0
  36. pluggy_sdk/models/__init__.py +178 -0
  37. pluggy_sdk/models/account.py +134 -0
  38. pluggy_sdk/models/accounts_list200_response.py +102 -0
  39. pluggy_sdk/models/acquirer_anticipation.py +117 -0
  40. pluggy_sdk/models/acquirer_anticipation_data.py +101 -0
  41. pluggy_sdk/models/acquirer_data.py +113 -0
  42. pluggy_sdk/models/acquirer_receivable.py +143 -0
  43. pluggy_sdk/models/acquirer_receivable_data.py +108 -0
  44. pluggy_sdk/models/acquirer_receivable_data_establishment.py +96 -0
  45. pluggy_sdk/models/acquirer_receivable_destination_account.py +92 -0
  46. pluggy_sdk/models/acquirer_receivable_related_sale.py +99 -0
  47. pluggy_sdk/models/acquirer_sale.py +171 -0
  48. pluggy_sdk/models/acquirer_sale_data.py +150 -0
  49. pluggy_sdk/models/acquirer_sale_installment.py +93 -0
  50. pluggy_sdk/models/acquirer_sale_installment_data.py +95 -0
  51. pluggy_sdk/models/address.py +110 -0
  52. pluggy_sdk/models/aggregated_portfolio.py +120 -0
  53. pluggy_sdk/models/aggregated_portfolio_response.py +102 -0
  54. pluggy_sdk/models/asset_distribution.py +88 -0
  55. pluggy_sdk/models/auth_request.py +90 -0
  56. pluggy_sdk/models/auth_response.py +88 -0
  57. pluggy_sdk/models/bank_data.py +92 -0
  58. pluggy_sdk/models/benefit_loan.py +121 -0
  59. pluggy_sdk/models/benefit_loan_client.py +102 -0
  60. pluggy_sdk/models/benefit_response.py +118 -0
  61. pluggy_sdk/models/benefit_response_paying_institution.py +94 -0
  62. pluggy_sdk/models/benefits_list200_response.py +102 -0
  63. pluggy_sdk/models/bill.py +109 -0
  64. pluggy_sdk/models/bill_finance_charge.py +103 -0
  65. pluggy_sdk/models/bills_list200_response.py +102 -0
  66. pluggy_sdk/models/boleto.py +121 -0
  67. pluggy_sdk/models/boleto_payer.py +90 -0
  68. pluggy_sdk/models/boleto_recipient.py +90 -0
  69. pluggy_sdk/models/bulk_payment.py +128 -0
  70. pluggy_sdk/models/bulk_payments_list200_response.py +102 -0
  71. pluggy_sdk/models/category.py +96 -0
  72. pluggy_sdk/models/client_category_rule.py +94 -0
  73. pluggy_sdk/models/company.py +90 -0
  74. pluggy_sdk/models/connect_token_request.py +94 -0
  75. pluggy_sdk/models/connect_token_response.py +88 -0
  76. pluggy_sdk/models/connector.py +145 -0
  77. pluggy_sdk/models/connector_credential.py +121 -0
  78. pluggy_sdk/models/connector_health.py +96 -0
  79. pluggy_sdk/models/connector_health_details.py +90 -0
  80. pluggy_sdk/models/connector_list_response.py +102 -0
  81. pluggy_sdk/models/connector_user_action.py +93 -0
  82. pluggy_sdk/models/consent.py +120 -0
  83. pluggy_sdk/models/create_boleto_payment_request.py +98 -0
  84. pluggy_sdk/models/create_bulk_payment.py +96 -0
  85. pluggy_sdk/models/create_client_category_rule.py +92 -0
  86. pluggy_sdk/models/create_item.py +113 -0
  87. pluggy_sdk/models/create_item_parameters.py +144 -0
  88. pluggy_sdk/models/create_or_update_payment_customer.py +105 -0
  89. pluggy_sdk/models/create_payment_customer_request_body.py +103 -0
  90. pluggy_sdk/models/create_payment_intent.py +110 -0
  91. pluggy_sdk/models/create_payment_recipient.py +104 -0
  92. pluggy_sdk/models/create_payment_request.py +110 -0
  93. pluggy_sdk/models/create_pix_qr_payment_request.py +96 -0
  94. pluggy_sdk/models/create_smart_account_request.py +102 -0
  95. pluggy_sdk/models/create_smart_account_transfer_request.py +92 -0
  96. pluggy_sdk/models/create_smart_transfer_payment.py +96 -0
  97. pluggy_sdk/models/create_smart_transfer_preauthorization.py +104 -0
  98. pluggy_sdk/models/create_webhook.py +99 -0
  99. pluggy_sdk/models/credential_select_option.py +90 -0
  100. pluggy_sdk/models/credit_card_metadata.py +101 -0
  101. pluggy_sdk/models/credit_data.py +127 -0
  102. pluggy_sdk/models/custom.py +100 -0
  103. pluggy_sdk/models/daily.py +101 -0
  104. pluggy_sdk/models/document.py +100 -0
  105. pluggy_sdk/models/email.py +100 -0
  106. pluggy_sdk/models/global_error_response.py +94 -0
  107. pluggy_sdk/models/i_count_response.py +88 -0
  108. pluggy_sdk/models/identity_relation.py +102 -0
  109. pluggy_sdk/models/identity_response.py +149 -0
  110. pluggy_sdk/models/income_report.py +90 -0
  111. pluggy_sdk/models/income_reports_response.py +102 -0
  112. pluggy_sdk/models/investment.py +192 -0
  113. pluggy_sdk/models/investment_expenses.py +108 -0
  114. pluggy_sdk/models/investment_metadata.py +100 -0
  115. pluggy_sdk/models/investment_transaction.py +124 -0
  116. pluggy_sdk/models/investments_list200_response.py +102 -0
  117. pluggy_sdk/models/item.py +150 -0
  118. pluggy_sdk/models/item_creation_error_response.py +102 -0
  119. pluggy_sdk/models/item_error.py +94 -0
  120. pluggy_sdk/models/item_options.py +90 -0
  121. pluggy_sdk/models/loan.py +199 -0
  122. pluggy_sdk/models/loan_contracted_fee.py +118 -0
  123. pluggy_sdk/models/loan_contracted_finance_charge.py +92 -0
  124. pluggy_sdk/models/loan_installment_balloon_payment.py +95 -0
  125. pluggy_sdk/models/loan_installment_balloon_payment_amount.py +90 -0
  126. pluggy_sdk/models/loan_installments.py +130 -0
  127. pluggy_sdk/models/loan_interest_rate.py +136 -0
  128. pluggy_sdk/models/loan_payment_release.py +103 -0
  129. pluggy_sdk/models/loan_payment_release_over_parcel.py +106 -0
  130. pluggy_sdk/models/loan_payment_release_over_parcel_charge.py +92 -0
  131. pluggy_sdk/models/loan_payment_release_over_parcel_fee.py +92 -0
  132. pluggy_sdk/models/loan_payments.py +98 -0
  133. pluggy_sdk/models/loan_warranty.py +94 -0
  134. pluggy_sdk/models/loans_list200_response.py +102 -0
  135. pluggy_sdk/models/merchant.py +96 -0
  136. pluggy_sdk/models/monthly.py +103 -0
  137. pluggy_sdk/models/monthly_portfolio.py +100 -0
  138. pluggy_sdk/models/monthly_portfolio_response.py +102 -0
  139. pluggy_sdk/models/not_authenticated_response.py +90 -0
  140. pluggy_sdk/models/page_response_acquirer_anticipations.py +102 -0
  141. pluggy_sdk/models/page_response_acquirer_receivables.py +102 -0
  142. pluggy_sdk/models/page_response_acquirer_sales.py +102 -0
  143. pluggy_sdk/models/page_response_category_rules.py +102 -0
  144. pluggy_sdk/models/page_response_consents.py +102 -0
  145. pluggy_sdk/models/page_response_investment_transactions.py +102 -0
  146. pluggy_sdk/models/page_response_transactions.py +102 -0
  147. pluggy_sdk/models/parameter_validation_error.py +92 -0
  148. pluggy_sdk/models/parameter_validation_response.py +98 -0
  149. pluggy_sdk/models/payment_customer.py +105 -0
  150. pluggy_sdk/models/payment_customers_list200_response.py +102 -0
  151. pluggy_sdk/models/payment_data.py +105 -0
  152. pluggy_sdk/models/payment_data_participant.py +102 -0
  153. pluggy_sdk/models/payment_institution.py +101 -0
  154. pluggy_sdk/models/payment_intent.py +145 -0
  155. pluggy_sdk/models/payment_intent_parameter.py +90 -0
  156. pluggy_sdk/models/payment_intents_list200_response.py +102 -0
  157. pluggy_sdk/models/payment_receipt.py +120 -0
  158. pluggy_sdk/models/payment_receipt_bank_account.py +92 -0
  159. pluggy_sdk/models/payment_receipt_person.py +96 -0
  160. pluggy_sdk/models/payment_recipient.py +110 -0
  161. pluggy_sdk/models/payment_recipient_account.py +92 -0
  162. pluggy_sdk/models/payment_recipients_institution_list200_response.py +102 -0
  163. pluggy_sdk/models/payment_recipients_list200_response.py +102 -0
  164. pluggy_sdk/models/payment_request.py +132 -0
  165. pluggy_sdk/models/payment_request_callback_urls.py +92 -0
  166. pluggy_sdk/models/payment_request_receipt_list200_response.py +102 -0
  167. pluggy_sdk/models/payment_request_schedule.py +183 -0
  168. pluggy_sdk/models/payment_requests_list200_response.py +102 -0
  169. pluggy_sdk/models/payment_schedules_list200_response.py +102 -0
  170. pluggy_sdk/models/payroll_loan.py +121 -0
  171. pluggy_sdk/models/payroll_loan_client.py +102 -0
  172. pluggy_sdk/models/payroll_loan_response.py +125 -0
  173. pluggy_sdk/models/payroll_loan_response_client.py +102 -0
  174. pluggy_sdk/models/payroll_loans_list200_response.py +102 -0
  175. pluggy_sdk/models/percentage_over_index.py +90 -0
  176. pluggy_sdk/models/phone_number.py +100 -0
  177. pluggy_sdk/models/pix_data.py +90 -0
  178. pluggy_sdk/models/schedule_payment.py +102 -0
  179. pluggy_sdk/models/schedule_type_custom.py +100 -0
  180. pluggy_sdk/models/schedule_type_daily.py +101 -0
  181. pluggy_sdk/models/schedule_type_monthly.py +103 -0
  182. pluggy_sdk/models/schedule_type_single.py +98 -0
  183. pluggy_sdk/models/schedule_type_weekly.py +110 -0
  184. pluggy_sdk/models/single.py +98 -0
  185. pluggy_sdk/models/smart_account.py +107 -0
  186. pluggy_sdk/models/smart_account_address.py +112 -0
  187. pluggy_sdk/models/smart_account_balance.py +95 -0
  188. pluggy_sdk/models/smart_account_transfer.py +123 -0
  189. pluggy_sdk/models/smart_accounts_list200_response.py +102 -0
  190. pluggy_sdk/models/smart_tranfers_preauthorizations_list200_response.py +102 -0
  191. pluggy_sdk/models/smart_transfer_callback_urls.py +90 -0
  192. pluggy_sdk/models/smart_transfer_payment.py +116 -0
  193. pluggy_sdk/models/smart_transfer_preauthorization.py +128 -0
  194. pluggy_sdk/models/smart_transfer_preauthorization_parameter.py +90 -0
  195. pluggy_sdk/models/status_detail.py +142 -0
  196. pluggy_sdk/models/status_detail_product.py +101 -0
  197. pluggy_sdk/models/status_detail_product_warning.py +92 -0
  198. pluggy_sdk/models/transaction.py +145 -0
  199. pluggy_sdk/models/update_item.py +109 -0
  200. pluggy_sdk/models/update_item_parameters.py +144 -0
  201. pluggy_sdk/models/update_payment_recipient.py +102 -0
  202. pluggy_sdk/models/update_payment_request.py +102 -0
  203. pluggy_sdk/models/update_transaction.py +88 -0
  204. pluggy_sdk/models/webhook.py +106 -0
  205. pluggy_sdk/models/webhook_creation_error_response.py +90 -0
  206. pluggy_sdk/models/webhooks_list200_response.py +102 -0
  207. pluggy_sdk/models/weekly.py +110 -0
  208. pluggy_sdk/py.typed +0 -0
  209. pluggy_sdk/rest.py +258 -0
  210. pluggy_sdk-1.0.0.post20.dist-info/METADATA +388 -0
  211. pluggy_sdk-1.0.0.post20.dist-info/RECORD +213 -0
  212. pluggy_sdk-1.0.0.post20.dist-info/WHEEL +5 -0
  213. pluggy_sdk-1.0.0.post20.dist-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ """API response object."""
2
+
3
+ from __future__ import annotations
4
+ from typing import Optional, Generic, Mapping, TypeVar
5
+ from pydantic import Field, StrictInt, StrictBytes, BaseModel
6
+
7
+ T = TypeVar("T")
8
+
9
+ class ApiResponse(BaseModel, Generic[T]):
10
+ """
11
+ API response object
12
+ """
13
+
14
+ status_code: StrictInt = Field(description="HTTP status code")
15
+ headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers")
16
+ data: T = Field(description="Deserialized data given the data type")
17
+ raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
18
+
19
+ model_config = {
20
+ "arbitrary_types_allowed": True
21
+ }
@@ -0,0 +1,480 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pluggy API
5
+
6
+ Pluggy's main API to review data and execute connectors
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: hello@pluggy.ai
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ import copy
17
+ import logging
18
+ from logging import FileHandler
19
+ import multiprocessing
20
+ import sys
21
+ from typing import Optional
22
+ import urllib3
23
+
24
+ import http.client as httplib
25
+
26
+ JSON_SCHEMA_VALIDATION_KEYWORDS = {
27
+ 'multipleOf', 'maximum', 'exclusiveMaximum',
28
+ 'minimum', 'exclusiveMinimum', 'maxLength',
29
+ 'minLength', 'pattern', 'maxItems', 'minItems'
30
+ }
31
+
32
+ class Configuration:
33
+ """This class contains various settings of the API client.
34
+
35
+ :param host: Base url.
36
+ :param ignore_operation_servers
37
+ Boolean to ignore operation servers for the API client.
38
+ Config will use `host` as the base url regardless of the operation servers.
39
+ :param api_key: Dict to store API key(s).
40
+ Each entry in the dict specifies an API key.
41
+ The dict key is the name of the security scheme in the OAS specification.
42
+ The dict value is the API key secret.
43
+ :param api_key_prefix: Dict to store API prefix (e.g. Bearer).
44
+ The dict key is the name of the security scheme in the OAS specification.
45
+ The dict value is an API key prefix when generating the auth data.
46
+ :param username: Username for HTTP basic authentication.
47
+ :param password: Password for HTTP basic authentication.
48
+ :param access_token: Access token.
49
+ :param server_index: Index to servers configuration.
50
+ :param server_variables: Mapping with string values to replace variables in
51
+ templated server configuration. The validation of enums is performed for
52
+ variables with defined enum values before.
53
+ :param server_operation_index: Mapping from operation ID to an index to server
54
+ configuration.
55
+ :param server_operation_variables: Mapping from operation ID to a mapping with
56
+ string values to replace variables in templated server configuration.
57
+ The validation of enums is performed for variables with defined enum
58
+ values before.
59
+ :param ssl_ca_cert: str - the path to a file of concatenated CA certificates
60
+ in PEM format.
61
+ :param retries: Number of retries for API requests.
62
+
63
+ :Example:
64
+
65
+ API Key Authentication Example.
66
+ Given the following security scheme in the OpenAPI specification:
67
+ components:
68
+ securitySchemes:
69
+ cookieAuth: # name for the security scheme
70
+ type: apiKey
71
+ in: cookie
72
+ name: JSESSIONID # cookie name
73
+
74
+ You can programmatically set the cookie:
75
+
76
+ conf = pluggy_sdk.Configuration(
77
+ api_key={'cookieAuth': 'abc123'}
78
+ api_key_prefix={'cookieAuth': 'JSESSIONID'}
79
+ )
80
+
81
+ The following cookie will be added to the HTTP request:
82
+ Cookie: JSESSIONID abc123
83
+ """
84
+
85
+ _default = None
86
+
87
+ def __init__(self, host=None,
88
+ api_key=None, api_key_prefix=None,
89
+ username=None, password=None,
90
+ access_token=None,
91
+ server_index=None, server_variables=None,
92
+ server_operation_index=None, server_operation_variables=None,
93
+ ignore_operation_servers=False,
94
+ ssl_ca_cert=None,
95
+ retries=None,
96
+ *,
97
+ debug: Optional[bool] = None
98
+ ) -> None:
99
+ """Constructor
100
+ """
101
+ self._base_path = "https://api.pluggy.ai" if host is None else host
102
+ """Default Base url
103
+ """
104
+ self.server_index = 0 if server_index is None and host is None else server_index
105
+ self.server_operation_index = server_operation_index or {}
106
+ """Default server index
107
+ """
108
+ self.server_variables = server_variables or {}
109
+ self.server_operation_variables = server_operation_variables or {}
110
+ """Default server variables
111
+ """
112
+ self.ignore_operation_servers = ignore_operation_servers
113
+ """Ignore operation servers
114
+ """
115
+ self.temp_folder_path = None
116
+ """Temp file folder for downloading files
117
+ """
118
+ # Authentication Settings
119
+ self.api_key = {}
120
+ if api_key:
121
+ self.api_key = api_key
122
+ """dict to store API key(s)
123
+ """
124
+ self.api_key_prefix = {}
125
+ if api_key_prefix:
126
+ self.api_key_prefix = api_key_prefix
127
+ """dict to store API prefix (e.g. Bearer)
128
+ """
129
+ self.refresh_api_key_hook = None
130
+ """function hook to refresh API key if expired
131
+ """
132
+ self.username = username
133
+ """Username for HTTP basic authentication
134
+ """
135
+ self.password = password
136
+ """Password for HTTP basic authentication
137
+ """
138
+ self.access_token = access_token
139
+ """Access token
140
+ """
141
+ self.logger = {}
142
+ """Logging Settings
143
+ """
144
+ self.logger["package_logger"] = logging.getLogger("pluggy_sdk")
145
+ self.logger["urllib3_logger"] = logging.getLogger("urllib3")
146
+ self.logger_format = '%(asctime)s %(levelname)s %(message)s'
147
+ """Log format
148
+ """
149
+ self.logger_stream_handler = None
150
+ """Log stream handler
151
+ """
152
+ self.logger_file_handler: Optional[FileHandler] = None
153
+ """Log file handler
154
+ """
155
+ self.logger_file = None
156
+ """Debug file location
157
+ """
158
+ if debug is not None:
159
+ self.debug = debug
160
+ else:
161
+ self.__debug = False
162
+ """Debug switch
163
+ """
164
+
165
+ self.verify_ssl = True
166
+ """SSL/TLS verification
167
+ Set this to false to skip verifying SSL certificate when calling API
168
+ from https server.
169
+ """
170
+ self.ssl_ca_cert = ssl_ca_cert
171
+ """Set this to customize the certificate file to verify the peer.
172
+ """
173
+ self.cert_file = None
174
+ """client certificate file
175
+ """
176
+ self.key_file = None
177
+ """client key file
178
+ """
179
+ self.assert_hostname = None
180
+ """Set this to True/False to enable/disable SSL hostname verification.
181
+ """
182
+ self.tls_server_name = None
183
+ """SSL/TLS Server Name Indication (SNI)
184
+ Set this to the SNI value expected by the server.
185
+ """
186
+
187
+ self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
188
+ """urllib3 connection pool's maximum number of connections saved
189
+ per pool. urllib3 uses 1 connection as default value, but this is
190
+ not the best value when you are making a lot of possibly parallel
191
+ requests to the same host, which is often the case here.
192
+ cpu_count * 5 is used as default value to increase performance.
193
+ """
194
+
195
+ self.proxy: Optional[str] = None
196
+ """Proxy URL
197
+ """
198
+ self.proxy_headers = None
199
+ """Proxy headers
200
+ """
201
+ self.safe_chars_for_path_param = ''
202
+ """Safe chars for path_param
203
+ """
204
+ self.retries = retries
205
+ """Adding retries to override urllib3 default value 3
206
+ """
207
+ # Enable client side validation
208
+ self.client_side_validation = True
209
+
210
+ self.socket_options = None
211
+ """Options to pass down to the underlying urllib3 socket
212
+ """
213
+
214
+ self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
215
+ """datetime format
216
+ """
217
+
218
+ self.date_format = "%Y-%m-%d"
219
+ """date format
220
+ """
221
+
222
+ def __deepcopy__(self, memo):
223
+ cls = self.__class__
224
+ result = cls.__new__(cls)
225
+ memo[id(self)] = result
226
+ for k, v in self.__dict__.items():
227
+ if k not in ('logger', 'logger_file_handler'):
228
+ setattr(result, k, copy.deepcopy(v, memo))
229
+ # shallow copy of loggers
230
+ result.logger = copy.copy(self.logger)
231
+ # use setters to configure loggers
232
+ result.logger_file = self.logger_file
233
+ result.debug = self.debug
234
+ return result
235
+
236
+ def __setattr__(self, name, value):
237
+ object.__setattr__(self, name, value)
238
+
239
+ @classmethod
240
+ def set_default(cls, default):
241
+ """Set default instance of configuration.
242
+
243
+ It stores default configuration, which can be
244
+ returned by get_default_copy method.
245
+
246
+ :param default: object of Configuration
247
+ """
248
+ cls._default = default
249
+
250
+ @classmethod
251
+ def get_default_copy(cls):
252
+ """Deprecated. Please use `get_default` instead.
253
+
254
+ Deprecated. Please use `get_default` instead.
255
+
256
+ :return: The configuration object.
257
+ """
258
+ return cls.get_default()
259
+
260
+ @classmethod
261
+ def get_default(cls):
262
+ """Return the default configuration.
263
+
264
+ This method returns newly created, based on default constructor,
265
+ object of Configuration class or returns a copy of default
266
+ configuration.
267
+
268
+ :return: The configuration object.
269
+ """
270
+ if cls._default is None:
271
+ cls._default = Configuration()
272
+ return cls._default
273
+
274
+ @property
275
+ def logger_file(self):
276
+ """The logger file.
277
+
278
+ If the logger_file is None, then add stream handler and remove file
279
+ handler. Otherwise, add file handler and remove stream handler.
280
+
281
+ :param value: The logger_file path.
282
+ :type: str
283
+ """
284
+ return self.__logger_file
285
+
286
+ @logger_file.setter
287
+ def logger_file(self, value):
288
+ """The logger file.
289
+
290
+ If the logger_file is None, then add stream handler and remove file
291
+ handler. Otherwise, add file handler and remove stream handler.
292
+
293
+ :param value: The logger_file path.
294
+ :type: str
295
+ """
296
+ self.__logger_file = value
297
+ if self.__logger_file:
298
+ # If set logging file,
299
+ # then add file handler and remove stream handler.
300
+ self.logger_file_handler = logging.FileHandler(self.__logger_file)
301
+ self.logger_file_handler.setFormatter(self.logger_formatter)
302
+ for _, logger in self.logger.items():
303
+ logger.addHandler(self.logger_file_handler)
304
+
305
+ @property
306
+ def debug(self):
307
+ """Debug status
308
+
309
+ :param value: The debug status, True or False.
310
+ :type: bool
311
+ """
312
+ return self.__debug
313
+
314
+ @debug.setter
315
+ def debug(self, value):
316
+ """Debug status
317
+
318
+ :param value: The debug status, True or False.
319
+ :type: bool
320
+ """
321
+ self.__debug = value
322
+ if self.__debug:
323
+ # if debug status is True, turn on debug logging
324
+ for _, logger in self.logger.items():
325
+ logger.setLevel(logging.DEBUG)
326
+ # turn on httplib debug
327
+ httplib.HTTPConnection.debuglevel = 1
328
+ else:
329
+ # if debug status is False, turn off debug logging,
330
+ # setting log level to default `logging.WARNING`
331
+ for _, logger in self.logger.items():
332
+ logger.setLevel(logging.WARNING)
333
+ # turn off httplib debug
334
+ httplib.HTTPConnection.debuglevel = 0
335
+
336
+ @property
337
+ def logger_format(self):
338
+ """The logger format.
339
+
340
+ The logger_formatter will be updated when sets logger_format.
341
+
342
+ :param value: The format string.
343
+ :type: str
344
+ """
345
+ return self.__logger_format
346
+
347
+ @logger_format.setter
348
+ def logger_format(self, value):
349
+ """The logger format.
350
+
351
+ The logger_formatter will be updated when sets logger_format.
352
+
353
+ :param value: The format string.
354
+ :type: str
355
+ """
356
+ self.__logger_format = value
357
+ self.logger_formatter = logging.Formatter(self.__logger_format)
358
+
359
+ def get_api_key_with_prefix(self, identifier, alias=None):
360
+ """Gets API key (with prefix if set).
361
+
362
+ :param identifier: The identifier of apiKey.
363
+ :param alias: The alternative identifier of apiKey.
364
+ :return: The token for api key authentication.
365
+ """
366
+ if self.refresh_api_key_hook is not None:
367
+ self.refresh_api_key_hook(self)
368
+ key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None)
369
+ if key:
370
+ prefix = self.api_key_prefix.get(identifier)
371
+ if prefix:
372
+ return "%s %s" % (prefix, key)
373
+ else:
374
+ return key
375
+
376
+ def get_basic_auth_token(self):
377
+ """Gets HTTP basic authentication header (string).
378
+
379
+ :return: The token for basic HTTP authentication.
380
+ """
381
+ username = ""
382
+ if self.username is not None:
383
+ username = self.username
384
+ password = ""
385
+ if self.password is not None:
386
+ password = self.password
387
+ return urllib3.util.make_headers(
388
+ basic_auth=username + ':' + password
389
+ ).get('authorization')
390
+
391
+ def auth_settings(self):
392
+ """Gets Auth Settings dict for api client.
393
+
394
+ :return: The Auth Settings information dict.
395
+ """
396
+ auth = {}
397
+ if 'default' in self.api_key:
398
+ auth['default'] = {
399
+ 'type': 'api_key',
400
+ 'in': 'header',
401
+ 'key': 'X-API-KEY',
402
+ 'value': self.get_api_key_with_prefix(
403
+ 'default',
404
+ ),
405
+ }
406
+ return auth
407
+
408
+ def to_debug_report(self):
409
+ """Gets the essential information for debugging.
410
+
411
+ :return: The report for debugging.
412
+ """
413
+ return "Python SDK Debug Report:\n"\
414
+ "OS: {env}\n"\
415
+ "Python Version: {pyversion}\n"\
416
+ "Version of the API: 1.0.0\n"\
417
+ "SDK Package Version: 1.0.0.post20".\
418
+ format(env=sys.platform, pyversion=sys.version)
419
+
420
+ def get_host_settings(self):
421
+ """Gets an array of host settings
422
+
423
+ :return: An array of host settings
424
+ """
425
+ return [
426
+ {
427
+ 'url': "https://api.pluggy.ai",
428
+ 'description': "Pluggy API",
429
+ }
430
+ ]
431
+
432
+ def get_host_from_settings(self, index, variables=None, servers=None):
433
+ """Gets host URL based on the index and variables
434
+ :param index: array index of the host settings
435
+ :param variables: hash of variable and the corresponding value
436
+ :param servers: an array of host settings or None
437
+ :return: URL based on host settings
438
+ """
439
+ if index is None:
440
+ return self._base_path
441
+
442
+ variables = {} if variables is None else variables
443
+ servers = self.get_host_settings() if servers is None else servers
444
+
445
+ try:
446
+ server = servers[index]
447
+ except IndexError:
448
+ raise ValueError(
449
+ "Invalid index {0} when selecting the host settings. "
450
+ "Must be less than {1}".format(index, len(servers)))
451
+
452
+ url = server['url']
453
+
454
+ # go through variables and replace placeholders
455
+ for variable_name, variable in server.get('variables', {}).items():
456
+ used_value = variables.get(
457
+ variable_name, variable['default_value'])
458
+
459
+ if 'enum_values' in variable \
460
+ and used_value not in variable['enum_values']:
461
+ raise ValueError(
462
+ "The variable `{0}` in the host URL has invalid value "
463
+ "{1}. Must be {2}.".format(
464
+ variable_name, variables[variable_name],
465
+ variable['enum_values']))
466
+
467
+ url = url.replace("{" + variable_name + "}", used_value)
468
+
469
+ return url
470
+
471
+ @property
472
+ def host(self):
473
+ """Return generated host."""
474
+ return self.get_host_from_settings(self.server_index, variables=self.server_variables)
475
+
476
+ @host.setter
477
+ def host(self, value):
478
+ """Fix base path."""
479
+ self._base_path = value
480
+ self.server_index = None
@@ -0,0 +1,200 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pluggy API
5
+
6
+ Pluggy's main API to review data and execute connectors
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: hello@pluggy.ai
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from typing import Any, Optional
16
+ from typing_extensions import Self
17
+
18
+ class OpenApiException(Exception):
19
+ """The base exception class for all OpenAPIExceptions"""
20
+
21
+
22
+ class ApiTypeError(OpenApiException, TypeError):
23
+ def __init__(self, msg, path_to_item=None, valid_classes=None,
24
+ key_type=None) -> None:
25
+ """ Raises an exception for TypeErrors
26
+
27
+ Args:
28
+ msg (str): the exception message
29
+
30
+ Keyword Args:
31
+ path_to_item (list): a list of keys an indices to get to the
32
+ current_item
33
+ None if unset
34
+ valid_classes (tuple): the primitive classes that current item
35
+ should be an instance of
36
+ None if unset
37
+ key_type (bool): False if our value is a value in a dict
38
+ True if it is a key in a dict
39
+ False if our item is an item in a list
40
+ None if unset
41
+ """
42
+ self.path_to_item = path_to_item
43
+ self.valid_classes = valid_classes
44
+ self.key_type = key_type
45
+ full_msg = msg
46
+ if path_to_item:
47
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
48
+ super(ApiTypeError, self).__init__(full_msg)
49
+
50
+
51
+ class ApiValueError(OpenApiException, ValueError):
52
+ def __init__(self, msg, path_to_item=None) -> None:
53
+ """
54
+ Args:
55
+ msg (str): the exception message
56
+
57
+ Keyword Args:
58
+ path_to_item (list) the path to the exception in the
59
+ received_data dict. None if unset
60
+ """
61
+
62
+ self.path_to_item = path_to_item
63
+ full_msg = msg
64
+ if path_to_item:
65
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
66
+ super(ApiValueError, self).__init__(full_msg)
67
+
68
+
69
+ class ApiAttributeError(OpenApiException, AttributeError):
70
+ def __init__(self, msg, path_to_item=None) -> None:
71
+ """
72
+ Raised when an attribute reference or assignment fails.
73
+
74
+ Args:
75
+ msg (str): the exception message
76
+
77
+ Keyword Args:
78
+ path_to_item (None/list) the path to the exception in the
79
+ received_data dict
80
+ """
81
+ self.path_to_item = path_to_item
82
+ full_msg = msg
83
+ if path_to_item:
84
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
85
+ super(ApiAttributeError, self).__init__(full_msg)
86
+
87
+
88
+ class ApiKeyError(OpenApiException, KeyError):
89
+ def __init__(self, msg, path_to_item=None) -> None:
90
+ """
91
+ Args:
92
+ msg (str): the exception message
93
+
94
+ Keyword Args:
95
+ path_to_item (None/list) the path to the exception in the
96
+ received_data dict
97
+ """
98
+ self.path_to_item = path_to_item
99
+ full_msg = msg
100
+ if path_to_item:
101
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
102
+ super(ApiKeyError, self).__init__(full_msg)
103
+
104
+
105
+ class ApiException(OpenApiException):
106
+
107
+ def __init__(
108
+ self,
109
+ status=None,
110
+ reason=None,
111
+ http_resp=None,
112
+ *,
113
+ body: Optional[str] = None,
114
+ data: Optional[Any] = None,
115
+ ) -> None:
116
+ self.status = status
117
+ self.reason = reason
118
+ self.body = body
119
+ self.data = data
120
+ self.headers = None
121
+
122
+ if http_resp:
123
+ if self.status is None:
124
+ self.status = http_resp.status
125
+ if self.reason is None:
126
+ self.reason = http_resp.reason
127
+ if self.body is None:
128
+ try:
129
+ self.body = http_resp.data.decode('utf-8')
130
+ except Exception:
131
+ pass
132
+ self.headers = http_resp.getheaders()
133
+
134
+ @classmethod
135
+ def from_response(
136
+ cls,
137
+ *,
138
+ http_resp,
139
+ body: Optional[str],
140
+ data: Optional[Any],
141
+ ) -> Self:
142
+ if http_resp.status == 400:
143
+ raise BadRequestException(http_resp=http_resp, body=body, data=data)
144
+
145
+ if http_resp.status == 401:
146
+ raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
147
+
148
+ if http_resp.status == 403:
149
+ raise ForbiddenException(http_resp=http_resp, body=body, data=data)
150
+
151
+ if http_resp.status == 404:
152
+ raise NotFoundException(http_resp=http_resp, body=body, data=data)
153
+
154
+ if 500 <= http_resp.status <= 599:
155
+ raise ServiceException(http_resp=http_resp, body=body, data=data)
156
+ raise ApiException(http_resp=http_resp, body=body, data=data)
157
+
158
+ def __str__(self):
159
+ """Custom error messages for exception"""
160
+ error_message = "({0})\n"\
161
+ "Reason: {1}\n".format(self.status, self.reason)
162
+ if self.headers:
163
+ error_message += "HTTP response headers: {0}\n".format(
164
+ self.headers)
165
+
166
+ if self.data or self.body:
167
+ error_message += "HTTP response body: {0}\n".format(self.data or self.body)
168
+
169
+ return error_message
170
+
171
+
172
+ class BadRequestException(ApiException):
173
+ pass
174
+
175
+
176
+ class NotFoundException(ApiException):
177
+ pass
178
+
179
+
180
+ class UnauthorizedException(ApiException):
181
+ pass
182
+
183
+
184
+ class ForbiddenException(ApiException):
185
+ pass
186
+
187
+
188
+ class ServiceException(ApiException):
189
+ pass
190
+
191
+
192
+ def render_path(path_to_item):
193
+ """Returns a string representation of a path"""
194
+ result = ""
195
+ for pth in path_to_item:
196
+ if isinstance(pth, int):
197
+ result += "[{0}]".format(pth)
198
+ else:
199
+ result += "['{0}']".format(pth)
200
+ return result