pyznuny 0.0.1__tar.gz → 0.0.2__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.
- {pyznuny-0.0.1 → pyznuny-0.0.2}/PKG-INFO +2 -2
- {pyznuny-0.0.1 → pyznuny-0.0.2}/pyproject.toml +12 -6
- pyznuny-0.0.2/src/pyznuny/ticket/__init__.py +5 -0
- {pyznuny-0.0.1 → pyznuny-0.0.2}/src/pyznuny/ticket/client.py +26 -8
- {pyznuny-0.0.1 → pyznuny-0.0.2}/src/pyznuny/ticket/endpoints.py +1 -1
- {pyznuny-0.0.1 → pyznuny-0.0.2}/src/pyznuny/ticket/exceptions.py +4 -1
- {pyznuny-0.0.1 → pyznuny-0.0.2}/src/pyznuny/ticket/models.py +0 -1
- {pyznuny-0.0.1 → pyznuny-0.0.2}/src/pyznuny.egg-info/PKG-INFO +2 -2
- pyznuny-0.0.1/src/pyznuny/ticket/__init__.py +0 -7
- {pyznuny-0.0.1 → pyznuny-0.0.2}/README.md +0 -0
- {pyznuny-0.0.1 → pyznuny-0.0.2}/setup.cfg +0 -0
- {pyznuny-0.0.1 → pyznuny-0.0.2}/src/pyznuny/__init__.py +0 -0
- {pyznuny-0.0.1 → pyznuny-0.0.2}/src/pyznuny/ticket/routes.py +0 -0
- {pyznuny-0.0.1 → pyznuny-0.0.2}/src/pyznuny.egg-info/SOURCES.txt +0 -0
- {pyznuny-0.0.1 → pyznuny-0.0.2}/src/pyznuny.egg-info/dependency_links.txt +0 -0
- {pyznuny-0.0.1 → pyznuny-0.0.2}/src/pyznuny.egg-info/requires.txt +0 -0
- {pyznuny-0.0.1 → pyznuny-0.0.2}/src/pyznuny.egg-info/top_level.txt +0 -0
- {pyznuny-0.0.1 → pyznuny-0.0.2}/tests/test_main.py +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyznuny
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2
|
|
4
4
|
Summary: A Python client for interacting with the Znuny ticketing system API.
|
|
5
5
|
Author-email: Junior Rosa <jr.dasrosas@gmail.com>, Pablo Gascon <pablogasconiel445@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/Junior-Rosa/py-znuny
|
|
7
7
|
Project-URL: Repository, https://github.com/Junior-Rosa/py-znuny
|
|
8
8
|
Project-URL: Issues, https://github.com/Junior-Rosa/py-znuny/issues
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
Requires-Dist: httpx>=0.28.1
|
|
12
12
|
Requires-Dist: pydantic>=2.12.5
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pyznuny"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.2"
|
|
4
4
|
description = "A Python client for interacting with the Znuny ticketing system API."
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Junior Rosa", email = "jr.dasrosas@gmail.com" },
|
|
7
7
|
{ name = "Pablo Gascon", email = "pablogasconiel445@gmail.com" }
|
|
8
8
|
]
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
11
|
dependencies = [
|
|
12
12
|
"httpx>=0.28.1",
|
|
13
13
|
"pydantic>=2.12.5",
|
|
@@ -21,15 +21,21 @@ Issues = "https://github.com/Junior-Rosa/py-znuny/issues"
|
|
|
21
21
|
[dependency-groups]
|
|
22
22
|
dev = [
|
|
23
23
|
"linkify-it-py>=2.0.3",
|
|
24
|
-
"myst-parser>=5.0.0",
|
|
25
24
|
"pytest>=9.0.2",
|
|
26
25
|
"python-dotenv>=1.2.1",
|
|
27
26
|
"ruff>=0.14.13",
|
|
28
|
-
"sphinx>=9.1.0",
|
|
29
|
-
"sphinx-autodoc-typehints>=3.6.2",
|
|
30
|
-
"sphinx-rtd-theme>=3.1.0",
|
|
31
27
|
]
|
|
32
28
|
|
|
29
|
+
docs = [
|
|
30
|
+
"myst-parser>=5.0.0; python_version >= '3.12'",
|
|
31
|
+
"sphinx>=9.1.0; python_version >= '3.12'",
|
|
32
|
+
"sphinx-autodoc-typehints>=3.6.2; python_version >= '3.12'",
|
|
33
|
+
"sphinx-rtd-theme>=3.1.0; python_version >= '3.12'",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[tool.uv]
|
|
37
|
+
default-groups = ["dev"]
|
|
38
|
+
|
|
33
39
|
[tool.setuptools.packages.find]
|
|
34
40
|
where = ["src"]
|
|
35
41
|
|
|
@@ -10,23 +10,35 @@ if __name__ == "__main__" and __package__ is None:
|
|
|
10
10
|
import sys
|
|
11
11
|
|
|
12
12
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
|
|
13
|
-
from pyznuny.ticket.endpoints import
|
|
13
|
+
from pyznuny.ticket.endpoints import (
|
|
14
|
+
_DEFAULT_ENDPOINT_IDENTIFIERS,
|
|
15
|
+
_DEFAULT_ENDPOINTS,
|
|
16
|
+
Endpoint,
|
|
17
|
+
EndpointSetter,
|
|
18
|
+
EndpointsRegistry,
|
|
19
|
+
)
|
|
20
|
+
from pyznuny.ticket.exceptions import TicketClientError
|
|
14
21
|
from pyznuny.ticket.models import (
|
|
15
22
|
TicketCreateArticle,
|
|
16
23
|
TicketCreatePayload,
|
|
17
24
|
TicketCreateTicket,
|
|
18
25
|
)
|
|
19
|
-
from pyznuny.ticket.
|
|
20
|
-
from pyznuny.ticket.routes import TicketRoutes, SessionRoutes
|
|
26
|
+
from pyznuny.ticket.routes import SessionRoutes, TicketRoutes
|
|
21
27
|
else:
|
|
22
|
-
from .endpoints import
|
|
28
|
+
from .endpoints import (
|
|
29
|
+
_DEFAULT_ENDPOINT_IDENTIFIERS,
|
|
30
|
+
_DEFAULT_ENDPOINTS,
|
|
31
|
+
Endpoint,
|
|
32
|
+
EndpointSetter,
|
|
33
|
+
EndpointsRegistry,
|
|
34
|
+
)
|
|
35
|
+
from .exceptions import TicketClientError
|
|
23
36
|
from .models import (
|
|
24
37
|
TicketCreateArticle,
|
|
25
38
|
TicketCreatePayload,
|
|
26
39
|
TicketCreateTicket,
|
|
27
40
|
)
|
|
28
|
-
from .routes import
|
|
29
|
-
from .exceptions import TicketClientError
|
|
41
|
+
from .routes import SessionRoutes, TicketRoutes
|
|
30
42
|
|
|
31
43
|
|
|
32
44
|
|
|
@@ -171,8 +183,14 @@ class TicketClient:
|
|
|
171
183
|
endpoint_path = endpoint_path.format(**path_params)
|
|
172
184
|
response = self._client.request(endpoint_method, endpoint_path, **kwargs)
|
|
173
185
|
|
|
174
|
-
|
|
175
|
-
|
|
186
|
+
try:
|
|
187
|
+
response.raise_for_status()
|
|
188
|
+
except httpx.HTTPStatusError:
|
|
189
|
+
try:
|
|
190
|
+
error = response.json().get("Error")
|
|
191
|
+
except Exception:
|
|
192
|
+
error = response.text
|
|
193
|
+
# TODO: improve error to handle status codes
|
|
176
194
|
self._raise_error(error)
|
|
177
195
|
|
|
178
196
|
return response
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from typing import TYPE_CHECKING, Iterable, Mapping, MutableMapping
|
|
3
4
|
|
|
4
5
|
from .models import Endpoint
|
|
5
|
-
from typing import Iterable, Mapping, MutableMapping, TYPE_CHECKING
|
|
6
6
|
|
|
7
7
|
if TYPE_CHECKING:
|
|
8
8
|
from pyznuny.ticket.client import TicketClient
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from typing import Any, Mapping
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
class TicketClientError(Exception):
|
|
6
7
|
"""
|
|
7
8
|
Docstring for TicketClientError
|
|
@@ -11,5 +12,7 @@ class TicketClientError(Exception):
|
|
|
11
12
|
|
|
12
13
|
self.error = error
|
|
13
14
|
code = error.get("ErrorCode") if isinstance(error, dict) else error
|
|
14
|
-
message = error.get("ErrorMessage") or "Unknown error"
|
|
15
|
+
message = error.get("ErrorMessage") or "Unknown error" \
|
|
16
|
+
if isinstance(error, dict) else str(error)
|
|
17
|
+
|
|
15
18
|
super().__init__(f"{code}: {message}" if code else str(message))
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyznuny
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2
|
|
4
4
|
Summary: A Python client for interacting with the Znuny ticketing system API.
|
|
5
5
|
Author-email: Junior Rosa <jr.dasrosas@gmail.com>, Pablo Gascon <pablogasconiel445@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/Junior-Rosa/py-znuny
|
|
7
7
|
Project-URL: Repository, https://github.com/Junior-Rosa/py-znuny
|
|
8
8
|
Project-URL: Issues, https://github.com/Junior-Rosa/py-znuny/issues
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
Requires-Dist: httpx>=0.28.1
|
|
12
12
|
Requires-Dist: pydantic>=2.12.5
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|