cliV1 0.1.4__tar.gz → 0.1.5__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.
- cliv1-0.1.5/PKG-INFO +99 -0
- cliv1-0.1.5/README.md +84 -0
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/__init__.py +2 -3
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/api_helper.py +1 -1
- cliv1-0.1.5/apimaticcalculator/apimaticcalculator_client.py +63 -0
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/configuration.py +12 -52
- {cliv1-0.1.4/swaggerpetstoreopenapi30/http/auth → cliv1-0.1.5/apimaticcalculator/controllers}/__init__.py +2 -2
- cliv1-0.1.4/swaggerpetstoreopenapi30/apis/base_api.py → cliv1-0.1.5/apimaticcalculator/controllers/base_controller.py +7 -12
- cliv1-0.1.5/apimaticcalculator/controllers/simple_calculator_controller.py +69 -0
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/exceptions/__init__.py +0 -1
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/exceptions/api_exception.py +4 -4
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/http/__init__.py +0 -1
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/http/http_call_back.py +1 -1
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/http/http_client_provider.py +1 -1
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/http/http_method_enum.py +1 -1
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/http/http_request.py +1 -1
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/http/http_response.py +1 -1
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/http/proxy_settings.py +1 -1
- {cliv1-0.1.4/swaggerpetstoreopenapi30/logging/configuration → cliv1-0.1.5/apimaticcalculator/models}/__init__.py +1 -1
- cliv1-0.1.4/swaggerpetstoreopenapi30/models/order_status.py → cliv1-0.1.5/apimaticcalculator/models/operation_type_enum.py +13 -10
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/utilities/__init__.py +0 -1
- {cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/utilities/file_wrapper.py +1 -1
- cliv1-0.1.5/cliV1.egg-info/PKG-INFO +99 -0
- cliv1-0.1.5/cliV1.egg-info/SOURCES.txt +30 -0
- cliv1-0.1.5/cliV1.egg-info/top_level.txt +3 -0
- {cliv1-0.1.4 → cliv1-0.1.5}/pyproject.toml +3 -6
- cliv1-0.1.4/PKG-INFO +0 -166
- cliv1-0.1.4/README.md +0 -150
- cliv1-0.1.4/cliV1.egg-info/PKG-INFO +0 -166
- cliv1-0.1.4/cliV1.egg-info/SOURCES.txt +0 -52
- cliv1-0.1.4/cliV1.egg-info/top_level.txt +0 -3
- cliv1-0.1.4/swaggerpetstoreopenapi30/apis/__init__.py +0 -8
- cliv1-0.1.4/swaggerpetstoreopenapi30/apis/pet_api.py +0 -453
- cliv1-0.1.4/swaggerpetstoreopenapi30/apis/store_api.py +0 -213
- cliv1-0.1.4/swaggerpetstoreopenapi30/apis/user_api.py +0 -378
- cliv1-0.1.4/swaggerpetstoreopenapi30/exceptions/oauth_provider_exception.py +0 -75
- cliv1-0.1.4/swaggerpetstoreopenapi30/http/api_response.py +0 -67
- cliv1-0.1.4/swaggerpetstoreopenapi30/http/auth/api_key.py +0 -100
- cliv1-0.1.4/swaggerpetstoreopenapi30/http/auth/petstore_auth.py +0 -247
- cliv1-0.1.4/swaggerpetstoreopenapi30/logging/__init__.py +0 -6
- cliv1-0.1.4/swaggerpetstoreopenapi30/logging/configuration/api_logging_configuration.py +0 -398
- cliv1-0.1.4/swaggerpetstoreopenapi30/logging/sdk_logger.py +0 -28
- cliv1-0.1.4/swaggerpetstoreopenapi30/models/__init__.py +0 -15
- cliv1-0.1.4/swaggerpetstoreopenapi30/models/api_response.py +0 -185
- cliv1-0.1.4/swaggerpetstoreopenapi30/models/category.py +0 -159
- cliv1-0.1.4/swaggerpetstoreopenapi30/models/oauth_provider_error.py +0 -67
- cliv1-0.1.4/swaggerpetstoreopenapi30/models/oauth_scope_petstore_auth.py +0 -45
- cliv1-0.1.4/swaggerpetstoreopenapi30/models/oauth_token.py +0 -157
- cliv1-0.1.4/swaggerpetstoreopenapi30/models/order.py +0 -265
- cliv1-0.1.4/swaggerpetstoreopenapi30/models/pet.py +0 -258
- cliv1-0.1.4/swaggerpetstoreopenapi30/models/pet_status.py +0 -48
- cliv1-0.1.4/swaggerpetstoreopenapi30/models/tag.py +0 -159
- cliv1-0.1.4/swaggerpetstoreopenapi30/models/user.py +0 -315
- cliv1-0.1.4/swaggerpetstoreopenapi30/swaggerpetstoreopenapi_30_client.py +0 -104
- cliv1-0.1.4/swaggerpetstoreopenapi30/utilities/xml_utilities.py +0 -12
- {cliv1-0.1.4 → cliv1-0.1.5}/LICENSE +0 -0
- {cliv1-0.1.4 → cliv1-0.1.5}/MANIFEST.in +0 -0
- {cliv1-0.1.4 → cliv1-0.1.5}/cliV1.egg-info/dependency_links.txt +0 -0
- {cliv1-0.1.4 → cliv1-0.1.5}/cliV1.egg-info/requires.txt +0 -0
- {cliv1-0.1.4 → cliv1-0.1.5}/setup.cfg +0 -0
cliv1-0.1.5/PKG-INFO
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cliV1
|
|
3
|
+
Version: 0.1.5
|
|
4
|
+
Summary: The official Python library for the APIMATIC Calculator API
|
|
5
|
+
Requires-Python: >=3.7
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: apimatic-core>=0.2.24,~=0.2.0
|
|
9
|
+
Requires-Dist: apimatic-core-interfaces>=0.1.8,~=0.1.0
|
|
10
|
+
Requires-Dist: apimatic-requests-client-adapter>=0.1.10,~=0.1.0
|
|
11
|
+
Requires-Dist: python-dotenv<2.0,>=0.21
|
|
12
|
+
Provides-Extra: testutils
|
|
13
|
+
Requires-Dist: pytest>=7.2.2; extra == "testutils"
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# Getting Started with APIMATIC Calculator
|
|
18
|
+
|
|
19
|
+
## Introduction
|
|
20
|
+
|
|
21
|
+
Simple calculator API hosted on APIMATIC
|
|
22
|
+
|
|
23
|
+
## Install the Package
|
|
24
|
+
|
|
25
|
+
The package is compatible with Python versions `3.7+`.
|
|
26
|
+
Install the package from PyPi using the following pip command:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install cliV1==0.1.5
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
You can also view the package at:
|
|
33
|
+
https://pypi.python.org/pypi/cliV1/0.1.5
|
|
34
|
+
|
|
35
|
+
## Initialize the API Client
|
|
36
|
+
|
|
37
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/client.md)
|
|
38
|
+
|
|
39
|
+
The following parameters are configurable for the API Client:
|
|
40
|
+
|
|
41
|
+
| Parameter | Type | Description |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| http_client_instance | `Union[Session, HttpClientProvider]` | The Http Client passed from the sdk user for making requests |
|
|
44
|
+
| override_http_client_configuration | `bool` | The value which determines to override properties of the passed Http Client from the sdk user |
|
|
45
|
+
| http_call_back | `HttpCallBack` | The callback value that is invoked before and after an HTTP call is made to an endpoint |
|
|
46
|
+
| timeout | `float` | The value to use for connection timeout. <br> **Default: 60** |
|
|
47
|
+
| max_retries | `int` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
|
|
48
|
+
| backoff_factor | `float` | A backoff factor to apply between attempts after the second try. <br> **Default: 2** |
|
|
49
|
+
| retry_statuses | `Array of int` | The http statuses on which retry is to be done. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
|
50
|
+
| retry_methods | `Array of string` | The http methods on which retry is to be done. <br> **Default: ["GET", "PUT"]** |
|
|
51
|
+
| proxy_settings | [`ProxySettings`](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
|
|
52
|
+
|
|
53
|
+
The API client can be initialized as follows:
|
|
54
|
+
|
|
55
|
+
### Code-Based Client Initialization
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from apimaticcalculator.apimaticcalculator_client import ApimaticcalculatorClient
|
|
59
|
+
from apimaticcalculator.configuration import Environment
|
|
60
|
+
|
|
61
|
+
client = ApimaticcalculatorClient(
|
|
62
|
+
environment=Environment.PRODUCTION
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Environment-Based Client Initialization
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from apimaticcalculator.apimaticcalculator_client import ApimaticcalculatorClient
|
|
70
|
+
|
|
71
|
+
# Specify the path to your .env file if it’s located outside the project’s root directory.
|
|
72
|
+
client = ApimaticcalculatorClient.from_environment(dotenv_path='/path/to/.env')
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
See the [Environment-Based Client Initialization](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/environment-based-client-initialization.md) section for details.
|
|
76
|
+
|
|
77
|
+
## List of APIs
|
|
78
|
+
|
|
79
|
+
* [Simple Calculator](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/controllers/simple-calculator.md)
|
|
80
|
+
|
|
81
|
+
## SDK Infrastructure
|
|
82
|
+
|
|
83
|
+
### Configuration
|
|
84
|
+
|
|
85
|
+
* [ProxySettings](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/proxy-settings.md)
|
|
86
|
+
* [Environment-Based Client Initialization](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/environment-based-client-initialization.md)
|
|
87
|
+
|
|
88
|
+
### HTTP
|
|
89
|
+
|
|
90
|
+
* [HttpResponse](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/http-response.md)
|
|
91
|
+
* [HttpRequest](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/http-request.md)
|
|
92
|
+
|
|
93
|
+
### Utilities
|
|
94
|
+
|
|
95
|
+
* [ApiHelper](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/api-helper.md)
|
|
96
|
+
* [HttpDateTime](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/http-date-time.md)
|
|
97
|
+
* [RFC3339DateTime](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/rfc3339-date-time.md)
|
|
98
|
+
* [UnixDateTime](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/unix-date-time.md)
|
|
99
|
+
|
cliv1-0.1.5/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
|
|
2
|
+
# Getting Started with APIMATIC Calculator
|
|
3
|
+
|
|
4
|
+
## Introduction
|
|
5
|
+
|
|
6
|
+
Simple calculator API hosted on APIMATIC
|
|
7
|
+
|
|
8
|
+
## Install the Package
|
|
9
|
+
|
|
10
|
+
The package is compatible with Python versions `3.7+`.
|
|
11
|
+
Install the package from PyPi using the following pip command:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install cliV1==0.1.5
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
You can also view the package at:
|
|
18
|
+
https://pypi.python.org/pypi/cliV1/0.1.5
|
|
19
|
+
|
|
20
|
+
## Initialize the API Client
|
|
21
|
+
|
|
22
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/client.md)
|
|
23
|
+
|
|
24
|
+
The following parameters are configurable for the API Client:
|
|
25
|
+
|
|
26
|
+
| Parameter | Type | Description |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| http_client_instance | `Union[Session, HttpClientProvider]` | The Http Client passed from the sdk user for making requests |
|
|
29
|
+
| override_http_client_configuration | `bool` | The value which determines to override properties of the passed Http Client from the sdk user |
|
|
30
|
+
| http_call_back | `HttpCallBack` | The callback value that is invoked before and after an HTTP call is made to an endpoint |
|
|
31
|
+
| timeout | `float` | The value to use for connection timeout. <br> **Default: 60** |
|
|
32
|
+
| max_retries | `int` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
|
|
33
|
+
| backoff_factor | `float` | A backoff factor to apply between attempts after the second try. <br> **Default: 2** |
|
|
34
|
+
| retry_statuses | `Array of int` | The http statuses on which retry is to be done. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
|
35
|
+
| retry_methods | `Array of string` | The http methods on which retry is to be done. <br> **Default: ["GET", "PUT"]** |
|
|
36
|
+
| proxy_settings | [`ProxySettings`](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
|
|
37
|
+
|
|
38
|
+
The API client can be initialized as follows:
|
|
39
|
+
|
|
40
|
+
### Code-Based Client Initialization
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from apimaticcalculator.apimaticcalculator_client import ApimaticcalculatorClient
|
|
44
|
+
from apimaticcalculator.configuration import Environment
|
|
45
|
+
|
|
46
|
+
client = ApimaticcalculatorClient(
|
|
47
|
+
environment=Environment.PRODUCTION
|
|
48
|
+
)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Environment-Based Client Initialization
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from apimaticcalculator.apimaticcalculator_client import ApimaticcalculatorClient
|
|
55
|
+
|
|
56
|
+
# Specify the path to your .env file if it’s located outside the project’s root directory.
|
|
57
|
+
client = ApimaticcalculatorClient.from_environment(dotenv_path='/path/to/.env')
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
See the [Environment-Based Client Initialization](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/environment-based-client-initialization.md) section for details.
|
|
61
|
+
|
|
62
|
+
## List of APIs
|
|
63
|
+
|
|
64
|
+
* [Simple Calculator](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/controllers/simple-calculator.md)
|
|
65
|
+
|
|
66
|
+
## SDK Infrastructure
|
|
67
|
+
|
|
68
|
+
### Configuration
|
|
69
|
+
|
|
70
|
+
* [ProxySettings](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/proxy-settings.md)
|
|
71
|
+
* [Environment-Based Client Initialization](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/environment-based-client-initialization.md)
|
|
72
|
+
|
|
73
|
+
### HTTP
|
|
74
|
+
|
|
75
|
+
* [HttpResponse](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/http-response.md)
|
|
76
|
+
* [HttpRequest](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/http-request.md)
|
|
77
|
+
|
|
78
|
+
### Utilities
|
|
79
|
+
|
|
80
|
+
* [ApiHelper](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/api-helper.md)
|
|
81
|
+
* [HttpDateTime](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/http-date-time.md)
|
|
82
|
+
* [RFC3339DateTime](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/rfc3339-date-time.md)
|
|
83
|
+
* [UnixDateTime](https://www.github.com/WasifMatic/acme-python-sdk/tree/0.1.5/doc/unix-date-time.md)
|
|
84
|
+
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
# ruff: noqa: RUF022 | `__all__` is not sorted
|
|
3
3
|
__all__ = [
|
|
4
4
|
"api_helper",
|
|
5
|
-
"
|
|
5
|
+
"apimaticcalculator_client",
|
|
6
6
|
"configuration",
|
|
7
|
+
"controllers",
|
|
7
8
|
"exceptions",
|
|
8
9
|
"http",
|
|
9
|
-
"logging",
|
|
10
10
|
"models",
|
|
11
|
-
"swaggerpetstoreopenapi_30_client",
|
|
12
11
|
"utilities",
|
|
13
12
|
]
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""apimaticcalculator.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
from apimatic_core.configurations.global_configuration import (
|
|
8
|
+
GlobalConfiguration,
|
|
9
|
+
)
|
|
10
|
+
from apimatic_core.decorators.lazy_property import (
|
|
11
|
+
LazyProperty,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
from apimaticcalculator.configuration import (
|
|
15
|
+
Configuration,
|
|
16
|
+
Environment,
|
|
17
|
+
)
|
|
18
|
+
from apimaticcalculator.controllers.base_controller import (
|
|
19
|
+
BaseController,
|
|
20
|
+
)
|
|
21
|
+
from apimaticcalculator.controllers.simple_calculator_controller import (
|
|
22
|
+
SimpleCalculatorController,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ApimaticcalculatorClient(object):
|
|
27
|
+
"""Client that provide access to the ApimaticcalculatorClient APIs."""
|
|
28
|
+
|
|
29
|
+
@LazyProperty
|
|
30
|
+
def simple_calculator(self):
|
|
31
|
+
"""Provide access to the SimpleCalculatorController endpoints."""
|
|
32
|
+
return SimpleCalculatorController(self.global_configuration)
|
|
33
|
+
|
|
34
|
+
def __init__(self, http_client_instance=None,
|
|
35
|
+
override_http_client_configuration=False, http_call_back=None,
|
|
36
|
+
timeout=60, max_retries=0, backoff_factor=2,
|
|
37
|
+
retry_statuses=None, retry_methods=None, proxy_settings=None,
|
|
38
|
+
environment=Environment.PRODUCTION, config=None):
|
|
39
|
+
"""Initialize a new instance of ApimaticcalculatorClient."""
|
|
40
|
+
self.config = config or Configuration(
|
|
41
|
+
http_client_instance=http_client_instance,
|
|
42
|
+
override_http_client_configuration=override_http_client_configuration,
|
|
43
|
+
http_call_back=http_call_back, timeout=timeout,
|
|
44
|
+
max_retries=max_retries, backoff_factor=backoff_factor,
|
|
45
|
+
retry_statuses=retry_statuses, retry_methods=retry_methods,
|
|
46
|
+
proxy_settings=proxy_settings, environment=environment)
|
|
47
|
+
|
|
48
|
+
self.global_configuration = GlobalConfiguration(self.config)\
|
|
49
|
+
.global_errors(BaseController.global_errors())\
|
|
50
|
+
.base_uri_executor(self.config.get_base_uri)\
|
|
51
|
+
.user_agent(BaseController.user_agent(),
|
|
52
|
+
BaseController.user_agent_parameters())
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def from_environment(cls, dotenv_path=None, **overrides):
|
|
56
|
+
"""Create a client instance using environment variables.
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
ApimaticcalculatorClient instance.
|
|
60
|
+
|
|
61
|
+
"""
|
|
62
|
+
return cls(config=Configuration
|
|
63
|
+
.from_environment(dotenv_path=dotenv_path, **overrides))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""apimaticcalculator.
|
|
2
2
|
|
|
3
3
|
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
4
|
"""
|
|
@@ -15,17 +15,15 @@ from apimatic_requests_client_adapter.requests_client import (
|
|
|
15
15
|
)
|
|
16
16
|
from dotenv import load_dotenv
|
|
17
17
|
|
|
18
|
-
from
|
|
18
|
+
from apimaticcalculator.http.proxy_settings import (
|
|
19
19
|
ProxySettings,
|
|
20
20
|
)
|
|
21
|
-
from swaggerpetstoreopenapi30.logging.configuration.api_logging_configuration import (
|
|
22
|
-
LoggingConfiguration,
|
|
23
|
-
)
|
|
24
21
|
|
|
25
22
|
|
|
26
23
|
class Environment(Enum):
|
|
27
24
|
"""An enum for SDK environments."""
|
|
28
25
|
|
|
26
|
+
# This environment connect to the LIVE calculator API
|
|
29
27
|
PRODUCTION = 0
|
|
30
28
|
|
|
31
29
|
@classmethod
|
|
@@ -61,7 +59,6 @@ class Server(Enum):
|
|
|
61
59
|
"""An enum for API servers."""
|
|
62
60
|
|
|
63
61
|
DEFAULT = 0
|
|
64
|
-
AUTH_SERVER = 1
|
|
65
62
|
|
|
66
63
|
@classmethod
|
|
67
64
|
def from_value(cls, value, default=None):
|
|
@@ -100,29 +97,18 @@ class Configuration(HttpClientConfiguration):
|
|
|
100
97
|
"""Return current environment."""
|
|
101
98
|
return self._environment
|
|
102
99
|
|
|
103
|
-
@property
|
|
104
|
-
def petstore_auth_credentials(self):
|
|
105
|
-
"""Return current petstore_auth_credentials."""
|
|
106
|
-
return self._petstore_auth_credentials
|
|
107
|
-
|
|
108
|
-
@property
|
|
109
|
-
def api_key_credentials(self):
|
|
110
|
-
"""Return current api_key_credentials."""
|
|
111
|
-
return self._api_key_credentials
|
|
112
|
-
|
|
113
100
|
def __init__(self, http_client_instance=None,
|
|
114
101
|
override_http_client_configuration=False, http_call_back=None,
|
|
115
|
-
timeout=
|
|
116
|
-
retry_methods=None, proxy_settings=None,
|
|
117
|
-
environment=Environment.PRODUCTION
|
|
118
|
-
api_key_credentials=None):
|
|
102
|
+
timeout=60, max_retries=0, backoff_factor=2, retry_statuses=None,
|
|
103
|
+
retry_methods=None, proxy_settings=None,
|
|
104
|
+
environment=Environment.PRODUCTION):
|
|
119
105
|
"""Initialize Configuration object."""
|
|
120
106
|
if retry_methods is None:
|
|
121
|
-
retry_methods = ["GET", "PUT"
|
|
107
|
+
retry_methods = ["GET", "PUT"]
|
|
122
108
|
|
|
123
109
|
if retry_statuses is None:
|
|
124
110
|
retry_statuses = [408, 413, 429, 500, 502, 503, 504, 521,
|
|
125
|
-
522, 524
|
|
111
|
+
522, 524]
|
|
126
112
|
|
|
127
113
|
super().__init__(
|
|
128
114
|
http_client_instance=http_client_instance,
|
|
@@ -131,18 +117,11 @@ class Configuration(HttpClientConfiguration):
|
|
|
131
117
|
max_retries=max_retries, backoff_factor=backoff_factor,
|
|
132
118
|
retry_statuses=retry_statuses, retry_methods=retry_methods,
|
|
133
119
|
proxy_settings=proxy_settings,
|
|
134
|
-
logging_configuration=logging_configuration,
|
|
135
120
|
)
|
|
136
121
|
|
|
137
122
|
# Current API environment
|
|
138
123
|
self._environment = environment
|
|
139
124
|
|
|
140
|
-
# The object holding OAuth 2 Implicit Grant credentials
|
|
141
|
-
self._petstore_auth_credentials = petstore_auth_credentials
|
|
142
|
-
|
|
143
|
-
# The object holding Custom Header Signature credentials
|
|
144
|
-
self._api_key_credentials = api_key_credentials
|
|
145
|
-
|
|
146
125
|
# The Http Client to use for making requests.
|
|
147
126
|
self.set_http_client(self.create_http_client())
|
|
148
127
|
|
|
@@ -150,8 +129,7 @@ class Configuration(HttpClientConfiguration):
|
|
|
150
129
|
override_http_client_configuration=None, http_call_back=None,
|
|
151
130
|
timeout=None, max_retries=None, backoff_factor=None,
|
|
152
131
|
retry_statuses=None, retry_methods=None, proxy_settings=None,
|
|
153
|
-
|
|
154
|
-
petstore_auth_credentials=None, api_key_credentials=None):
|
|
132
|
+
environment=None):
|
|
155
133
|
"""Clone configuration with overrides."""
|
|
156
134
|
http_client_instance = http_client_instance or self.http_client_instance
|
|
157
135
|
override_http_client_configuration =\
|
|
@@ -164,21 +142,14 @@ class Configuration(HttpClientConfiguration):
|
|
|
164
142
|
retry_statuses = retry_statuses or self.retry_statuses
|
|
165
143
|
retry_methods = retry_methods or self.retry_methods
|
|
166
144
|
proxy_settings = proxy_settings or self.proxy_settings
|
|
167
|
-
logging_configuration = logging_configuration or self.logging_configuration
|
|
168
145
|
environment = environment or self.environment
|
|
169
|
-
petstore_auth_credentials =\
|
|
170
|
-
(petstore_auth_credentials
|
|
171
|
-
or self.petstore_auth_credentials)
|
|
172
|
-
api_key_credentials = api_key_credentials or self.api_key_credentials
|
|
173
146
|
return Configuration(
|
|
174
147
|
http_client_instance=http_client_instance,
|
|
175
148
|
override_http_client_configuration=override_http_client_configuration,
|
|
176
149
|
http_call_back=http_call_back, timeout=timeout, max_retries=max_retries,
|
|
177
150
|
backoff_factor=backoff_factor, retry_statuses=retry_statuses,
|
|
178
151
|
retry_methods=retry_methods, proxy_settings=proxy_settings,
|
|
179
|
-
|
|
180
|
-
petstore_auth_credentials=petstore_auth_credentials,
|
|
181
|
-
api_key_credentials=api_key_credentials,
|
|
152
|
+
environment=environment,
|
|
182
153
|
)
|
|
183
154
|
|
|
184
155
|
def create_http_client(self):
|
|
@@ -196,8 +167,7 @@ class Configuration(HttpClientConfiguration):
|
|
|
196
167
|
# All the environments the SDK can run in
|
|
197
168
|
environments = {
|
|
198
169
|
Environment.PRODUCTION: {
|
|
199
|
-
Server.DEFAULT: "https://
|
|
200
|
-
Server.AUTH_SERVER: "https://petstore3.swagger.io/oauth",
|
|
170
|
+
Server.DEFAULT: "https://examples.apimatic.io/apps/calculator",
|
|
201
171
|
},
|
|
202
172
|
}
|
|
203
173
|
|
|
@@ -232,7 +202,7 @@ class Configuration(HttpClientConfiguration):
|
|
|
232
202
|
|
|
233
203
|
override_http_client_configuration = os.getenv(
|
|
234
204
|
"OVERRIDE_HTTP_CLIENT_CONFIGURATION", "false").lower() == "true"
|
|
235
|
-
timeout = int(os.getenv("TIMEOUT", "
|
|
205
|
+
timeout = int(os.getenv("TIMEOUT", "60"))
|
|
236
206
|
max_retries = int(os.getenv("MAX_RETRIES", "0"))
|
|
237
207
|
backoff_factor = float(os.getenv("BACKOFF_FACTOR", "2"))
|
|
238
208
|
statuses = os.getenv("RETRY_STATUSES", None)
|
|
@@ -244,13 +214,6 @@ class Configuration(HttpClientConfiguration):
|
|
|
244
214
|
environment = Environment.from_value(
|
|
245
215
|
os.getenv("ENVIRONMENT"), Environment.PRODUCTION)
|
|
246
216
|
|
|
247
|
-
from swaggerpetstoreopenapi30.http.auth.api_key import (
|
|
248
|
-
ApiKeyCredentials,
|
|
249
|
-
)
|
|
250
|
-
from swaggerpetstoreopenapi30.http.auth.petstore_auth import (
|
|
251
|
-
PetstoreAuthCredentials,
|
|
252
|
-
)
|
|
253
|
-
|
|
254
217
|
# Preparing default configuration
|
|
255
218
|
default_config = cls(
|
|
256
219
|
override_http_client_configuration=override_http_client_configuration,
|
|
@@ -261,9 +224,6 @@ class Configuration(HttpClientConfiguration):
|
|
|
261
224
|
retry_methods=retry_methods,
|
|
262
225
|
environment=environment,
|
|
263
226
|
proxy_settings=ProxySettings.from_environment(),
|
|
264
|
-
logging_configuration=LoggingConfiguration.from_environment(),
|
|
265
|
-
petstore_auth_credentials=PetstoreAuthCredentials.from_environment(),
|
|
266
|
-
api_key_credentials=ApiKeyCredentials.from_environment(),
|
|
267
227
|
)
|
|
268
228
|
|
|
269
229
|
return default_config.clone_with(**overrides)
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""apimaticcalculator.
|
|
2
2
|
|
|
3
3
|
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
import platform
|
|
7
|
-
|
|
8
6
|
from apimatic_core.api_call import ApiCall
|
|
9
7
|
from apimatic_core.types.error_case import ErrorCase
|
|
10
8
|
|
|
11
|
-
from
|
|
12
|
-
|
|
9
|
+
from apimaticcalculator.exceptions.api_exception import (
|
|
10
|
+
APIException,
|
|
13
11
|
)
|
|
14
12
|
|
|
15
13
|
|
|
16
|
-
class
|
|
14
|
+
class BaseController(object):
|
|
17
15
|
"""All controllers inherit from this base class.
|
|
18
16
|
|
|
19
17
|
Attributes:
|
|
@@ -30,15 +28,12 @@ class BaseApi(object):
|
|
|
30
28
|
@staticmethod
|
|
31
29
|
def user_agent():
|
|
32
30
|
"""Return UserAgent value."""
|
|
33
|
-
return "
|
|
31
|
+
return "APIMATIC 3.0"
|
|
34
32
|
|
|
35
33
|
@staticmethod
|
|
36
34
|
def user_agent_parameters():
|
|
37
35
|
"""Return UserAgentParameters value."""
|
|
38
36
|
return {
|
|
39
|
-
"engine": {"value": platform.python_implementation(), "encode": False},
|
|
40
|
-
"engine-version": {"value": platform.python_version(), "encode": False},
|
|
41
|
-
"os-info": {"value": platform.system(), "encode": False},
|
|
42
37
|
}
|
|
43
38
|
|
|
44
39
|
@staticmethod
|
|
@@ -47,11 +42,11 @@ class BaseApi(object):
|
|
|
47
42
|
return {
|
|
48
43
|
"default": ErrorCase()
|
|
49
44
|
.error_message("HTTP response not OK.")
|
|
50
|
-
.exception_type(
|
|
45
|
+
.exception_type(APIException),
|
|
51
46
|
}
|
|
52
47
|
|
|
53
48
|
def __init__(self, config):
|
|
54
|
-
"""Initialize
|
|
49
|
+
"""Initialize BaseController object."""
|
|
55
50
|
self._config = config.get_http_client_configuration()
|
|
56
51
|
self._http_call_back = self.config.http_callback
|
|
57
52
|
self.api_call = ApiCall(config)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""apimaticcalculator.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: D410, E501, E101, D206
|
|
7
|
+
from apimatic_core.request_builder import RequestBuilder
|
|
8
|
+
from apimatic_core.response_handler import ResponseHandler
|
|
9
|
+
from apimatic_core.types.parameter import Parameter
|
|
10
|
+
|
|
11
|
+
from apimaticcalculator.api_helper import APIHelper
|
|
12
|
+
from apimaticcalculator.configuration import (
|
|
13
|
+
Server,
|
|
14
|
+
)
|
|
15
|
+
from apimaticcalculator.controllers.base_controller import (
|
|
16
|
+
BaseController,
|
|
17
|
+
)
|
|
18
|
+
from apimaticcalculator.http.http_method_enum import (
|
|
19
|
+
HttpMethodEnum,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class SimpleCalculatorController(BaseController):
|
|
24
|
+
"""A Controller to access Endpoints in the apimaticcalculator API."""
|
|
25
|
+
|
|
26
|
+
def __init__(self, config):
|
|
27
|
+
"""Initialize SimpleCalculatorController object."""
|
|
28
|
+
super(SimpleCalculatorController, self).__init__(config)
|
|
29
|
+
|
|
30
|
+
def calculate(self,
|
|
31
|
+
operation,
|
|
32
|
+
x,
|
|
33
|
+
y):
|
|
34
|
+
"""Perform a GET request to /{operation}.
|
|
35
|
+
|
|
36
|
+
Calculates the expression using the specified operation.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
operation (OperationTypeEnum): The operator to apply on the variables
|
|
40
|
+
x (float): The LHS value
|
|
41
|
+
y (float): The RHS value
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
float: Response from the API.
|
|
45
|
+
|
|
46
|
+
Raises:
|
|
47
|
+
APIException: When an error occurs while fetching the data from the
|
|
48
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
49
|
+
message, and the HTTP body that was received in the request.
|
|
50
|
+
|
|
51
|
+
"""
|
|
52
|
+
return super().new_api_call_builder.request(
|
|
53
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
54
|
+
.path("/{operation}")
|
|
55
|
+
.http_method(HttpMethodEnum.GET)
|
|
56
|
+
.template_param(Parameter()
|
|
57
|
+
.key("operation")
|
|
58
|
+
.value(operation)
|
|
59
|
+
.should_encode(True))
|
|
60
|
+
.query_param(Parameter()
|
|
61
|
+
.key("x")
|
|
62
|
+
.value(x))
|
|
63
|
+
.query_param(Parameter()
|
|
64
|
+
.key("y")
|
|
65
|
+
.value(y)),
|
|
66
|
+
).response(
|
|
67
|
+
ResponseHandler()
|
|
68
|
+
.deserializer(APIHelper.json_deserialize),
|
|
69
|
+
).execute()
|
{cliv1-0.1.4/swaggerpetstoreopenapi30 → cliv1-0.1.5/apimaticcalculator}/exceptions/api_exception.py
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""apimaticcalculator.
|
|
2
2
|
|
|
3
3
|
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class APIException(Exception):
|
|
8
8
|
"""Class that handles HTTP Exceptions when fetching API Endpoints.
|
|
9
9
|
|
|
10
10
|
Attributes:
|
|
@@ -16,7 +16,7 @@ class ApiException(Exception):
|
|
|
16
16
|
def __init__(self,
|
|
17
17
|
reason,
|
|
18
18
|
response):
|
|
19
|
-
"""Initialize
|
|
19
|
+
"""Initialize APIException object.
|
|
20
20
|
|
|
21
21
|
Args:
|
|
22
22
|
reason (string): The reason (or error message) for the Exception
|
|
@@ -24,7 +24,7 @@ class ApiException(Exception):
|
|
|
24
24
|
response (HttpResponse): The HttpResponse of the API call.
|
|
25
25
|
|
|
26
26
|
"""
|
|
27
|
-
super(
|
|
27
|
+
super(APIException, self).__init__(reason)
|
|
28
28
|
self.reason = reason
|
|
29
29
|
self.response = response
|
|
30
30
|
self.response_code = response.status_code
|