eet-gateway-client 0.1.0__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.
- eet_gateway_client-0.1.0/LICENSE +21 -0
- eet_gateway_client-0.1.0/PKG-INFO +67 -0
- eet_gateway_client-0.1.0/README.md +45 -0
- eet_gateway_client-0.1.0/pyproject.toml +39 -0
- eet_gateway_client-0.1.0/setup.cfg +4 -0
- eet_gateway_client-0.1.0/src/eet_gateway_client/__init__.py +75 -0
- eet_gateway_client-0.1.0/src/eet_gateway_client/client.py +481 -0
- eet_gateway_client-0.1.0/src/eet_gateway_client/errors.py +115 -0
- eet_gateway_client-0.1.0/src/eet_gateway_client/models.py +507 -0
- eet_gateway_client-0.1.0/src/eet_gateway_client/py.typed +0 -0
- eet_gateway_client-0.1.0/src/eet_gateway_client.egg-info/PKG-INFO +67 -0
- eet_gateway_client-0.1.0/src/eet_gateway_client.egg-info/SOURCES.txt +16 -0
- eet_gateway_client-0.1.0/src/eet_gateway_client.egg-info/dependency_links.txt +1 -0
- eet_gateway_client-0.1.0/src/eet_gateway_client.egg-info/requires.txt +3 -0
- eet_gateway_client-0.1.0/src/eet_gateway_client.egg-info/top_level.txt +1 -0
- eet_gateway_client-0.1.0/tests/test_client.py +562 -0
- eet_gateway_client-0.1.0/tests/test_integration.py +85 -0
- eet_gateway_client-0.1.0/tests/test_openapi_coverage.py +141 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EET Gateway contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: eet-gateway-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Typed Python client for the EET Gateway HTTP API v1 (Czech EET 2.0), standard library only.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/hospodskej-cz/eet-2-0
|
|
7
|
+
Project-URL: Documentation, https://github.com/hospodskej-cz/eet-2-0/tree/main/clients
|
|
8
|
+
Keywords: eet,eet2,czech,fiscalization,pos
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Typing :: Typed
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Provides-Extra: test
|
|
20
|
+
Requires-Dist: pytest>=7; extra == "test"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# eet-gateway-client (Python)
|
|
24
|
+
|
|
25
|
+
Typed Python client for the [EET Gateway](https://github.com/hospodskej-cz/eet-2-0) HTTP API v1
|
|
26
|
+
(Czech EET 2.0). Python 3.9+, standard library only. Česky a o ostatních jazycích:
|
|
27
|
+
[clients/README.md](../README.md).
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
pip install ./clients/python # from a checkout; not on PyPI yet
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import os
|
|
35
|
+
from datetime import datetime
|
|
36
|
+
from eet_gateway_client import EetGatewayClient, IdempotencyConflictError, SaleStatus
|
|
37
|
+
|
|
38
|
+
client = EetGatewayClient("http://localhost:8080", api_key=os.environ["EET_API_KEY"])
|
|
39
|
+
|
|
40
|
+
result = client.submit_sale(
|
|
41
|
+
{
|
|
42
|
+
"porad_cis": "R-1001",
|
|
43
|
+
"dat_trzby": datetime.now().astimezone().isoformat(timespec="seconds"),
|
|
44
|
+
"celk_trzba": "123.50",
|
|
45
|
+
},
|
|
46
|
+
idempotency_key="R-1001", # repeat the call with the same key after any error
|
|
47
|
+
)
|
|
48
|
+
if result.is_pending: # queued | uncertain: the gateway keeps sending
|
|
49
|
+
result = client.wait_for_sale(result)
|
|
50
|
+
|
|
51
|
+
print(result.status, result.pok)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- `submit_sale` returns a `SaleResult` for HTTP 200 (`accepted`, `verification_ok`, `rejected`),
|
|
55
|
+
202 (`queued`, `uncertain`) and 422 (`invalid`, see `result.issues`). 409 raises
|
|
56
|
+
`IdempotencyConflictError`; other error statuses raise `ApiError` subclasses; no answer raises
|
|
57
|
+
`TransportError` / `RequestTimeoutError` (all derive from `EetGatewayError`).
|
|
58
|
+
- `SaleInput` (dataclass) is an alternative to a plain `dict`; `Decimal`, `float` and `datetime`
|
|
59
|
+
values are formatted for you.
|
|
60
|
+
- Every operation of the API is covered: `submit_sale`, `submit_batch`, `get_sale`,
|
|
61
|
+
`get_sale_attempts`, `retry_sale`, `list_queue` / `iter_queue`, `list_registers`,
|
|
62
|
+
`validate_sales`, `health`, `get_openapi`, `get_docs`; `*_raw` variants take NDJSON, CSV or XML.
|
|
63
|
+
- The client does not retry by itself, follows no redirects and sends the API key only to the
|
|
64
|
+
URL you gave it.
|
|
65
|
+
|
|
66
|
+
Tests: `pip install -e ".[test]" && pytest`. With `EET_URL` set (see the
|
|
67
|
+
[overview](../README.md#vývoj)) the integration tests run against a real gateway too.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# eet-gateway-client (Python)
|
|
2
|
+
|
|
3
|
+
Typed Python client for the [EET Gateway](https://github.com/hospodskej-cz/eet-2-0) HTTP API v1
|
|
4
|
+
(Czech EET 2.0). Python 3.9+, standard library only. Česky a o ostatních jazycích:
|
|
5
|
+
[clients/README.md](../README.md).
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pip install ./clients/python # from a checkout; not on PyPI yet
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
import os
|
|
13
|
+
from datetime import datetime
|
|
14
|
+
from eet_gateway_client import EetGatewayClient, IdempotencyConflictError, SaleStatus
|
|
15
|
+
|
|
16
|
+
client = EetGatewayClient("http://localhost:8080", api_key=os.environ["EET_API_KEY"])
|
|
17
|
+
|
|
18
|
+
result = client.submit_sale(
|
|
19
|
+
{
|
|
20
|
+
"porad_cis": "R-1001",
|
|
21
|
+
"dat_trzby": datetime.now().astimezone().isoformat(timespec="seconds"),
|
|
22
|
+
"celk_trzba": "123.50",
|
|
23
|
+
},
|
|
24
|
+
idempotency_key="R-1001", # repeat the call with the same key after any error
|
|
25
|
+
)
|
|
26
|
+
if result.is_pending: # queued | uncertain: the gateway keeps sending
|
|
27
|
+
result = client.wait_for_sale(result)
|
|
28
|
+
|
|
29
|
+
print(result.status, result.pok)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- `submit_sale` returns a `SaleResult` for HTTP 200 (`accepted`, `verification_ok`, `rejected`),
|
|
33
|
+
202 (`queued`, `uncertain`) and 422 (`invalid`, see `result.issues`). 409 raises
|
|
34
|
+
`IdempotencyConflictError`; other error statuses raise `ApiError` subclasses; no answer raises
|
|
35
|
+
`TransportError` / `RequestTimeoutError` (all derive from `EetGatewayError`).
|
|
36
|
+
- `SaleInput` (dataclass) is an alternative to a plain `dict`; `Decimal`, `float` and `datetime`
|
|
37
|
+
values are formatted for you.
|
|
38
|
+
- Every operation of the API is covered: `submit_sale`, `submit_batch`, `get_sale`,
|
|
39
|
+
`get_sale_attempts`, `retry_sale`, `list_queue` / `iter_queue`, `list_registers`,
|
|
40
|
+
`validate_sales`, `health`, `get_openapi`, `get_docs`; `*_raw` variants take NDJSON, CSV or XML.
|
|
41
|
+
- The client does not retry by itself, follows no redirects and sends the API key only to the
|
|
42
|
+
URL you gave it.
|
|
43
|
+
|
|
44
|
+
Tests: `pip install -e ".[test]" && pytest`. With `EET_URL` set (see the
|
|
45
|
+
[overview](../README.md#vývoj)) the integration tests run against a real gateway too.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "eet-gateway-client"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Typed Python client for the EET Gateway HTTP API v1 (Czech EET 2.0), standard library only."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
dependencies = []
|
|
14
|
+
keywords = ["eet", "eet2", "czech", "fiscalization", "pos"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.9",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Typing :: Typed",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
test = ["pytest>=7"]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/hospodskej-cz/eet-2-0"
|
|
30
|
+
Documentation = "https://github.com/hospodskej-cz/eet-2-0/tree/main/clients"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.packages.find]
|
|
33
|
+
where = ["src"]
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.package-data]
|
|
36
|
+
eet_gateway_client = ["py.typed"]
|
|
37
|
+
|
|
38
|
+
[tool.pytest.ini_options]
|
|
39
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""Python client for the EET Gateway HTTP API v1 (Czech EET 2.0). See clients/README.md."""
|
|
2
|
+
|
|
3
|
+
from .client import OPERATIONS, EetGatewayClient, __version__
|
|
4
|
+
from .errors import (
|
|
5
|
+
ApiError,
|
|
6
|
+
AuthenticationError,
|
|
7
|
+
BadRequestError,
|
|
8
|
+
ConflictError,
|
|
9
|
+
EetGatewayError,
|
|
10
|
+
IdempotencyConflictError,
|
|
11
|
+
InvalidResponseError,
|
|
12
|
+
NotFoundError,
|
|
13
|
+
PayloadTooLargeError,
|
|
14
|
+
RequestTimeoutError,
|
|
15
|
+
ServerError,
|
|
16
|
+
TransportError,
|
|
17
|
+
UnprocessableError,
|
|
18
|
+
UnsupportedMediaTypeError,
|
|
19
|
+
)
|
|
20
|
+
from .models import (
|
|
21
|
+
Attempt,
|
|
22
|
+
BatchResult,
|
|
23
|
+
BatchRow,
|
|
24
|
+
Certificate,
|
|
25
|
+
EetCheck,
|
|
26
|
+
Health,
|
|
27
|
+
Issue,
|
|
28
|
+
QueuePage,
|
|
29
|
+
Register,
|
|
30
|
+
SaleData,
|
|
31
|
+
SaleInput,
|
|
32
|
+
SaleResult,
|
|
33
|
+
SaleStatus,
|
|
34
|
+
SaleWarning,
|
|
35
|
+
ValidationBatch,
|
|
36
|
+
ValidationResult,
|
|
37
|
+
ValidationRow,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"OPERATIONS",
|
|
42
|
+
"ApiError",
|
|
43
|
+
"Attempt",
|
|
44
|
+
"AuthenticationError",
|
|
45
|
+
"BadRequestError",
|
|
46
|
+
"BatchResult",
|
|
47
|
+
"BatchRow",
|
|
48
|
+
"Certificate",
|
|
49
|
+
"ConflictError",
|
|
50
|
+
"EetCheck",
|
|
51
|
+
"EetGatewayClient",
|
|
52
|
+
"EetGatewayError",
|
|
53
|
+
"Health",
|
|
54
|
+
"IdempotencyConflictError",
|
|
55
|
+
"InvalidResponseError",
|
|
56
|
+
"Issue",
|
|
57
|
+
"NotFoundError",
|
|
58
|
+
"PayloadTooLargeError",
|
|
59
|
+
"QueuePage",
|
|
60
|
+
"Register",
|
|
61
|
+
"RequestTimeoutError",
|
|
62
|
+
"SaleData",
|
|
63
|
+
"SaleInput",
|
|
64
|
+
"SaleResult",
|
|
65
|
+
"SaleStatus",
|
|
66
|
+
"SaleWarning",
|
|
67
|
+
"ServerError",
|
|
68
|
+
"TransportError",
|
|
69
|
+
"UnprocessableError",
|
|
70
|
+
"UnsupportedMediaTypeError",
|
|
71
|
+
"ValidationBatch",
|
|
72
|
+
"ValidationResult",
|
|
73
|
+
"ValidationRow",
|
|
74
|
+
"__version__",
|
|
75
|
+
]
|