patera-apiinterface 0.9.0__tar.gz → 0.11.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Marko Šterk
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,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: patera-apiinterface
3
+ Version: 0.11.0
4
+ Summary: Declarative async HTTP clients for external APIs in Patera applications
5
+ Keywords: patera,http,client,api
6
+ Author: Marko Šterk
7
+ Author-email: Marko Šterk <marko_sterk@hotmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Framework :: AsyncIO
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Typing :: Typed
19
+ Classifier: Topic :: Internet :: WWW/HTTP
20
+ Requires-Dist: httpx>=0.28.1
21
+ Requires-Dist: patera>=0.121
22
+ Requires-Python: >=3.13
23
+ Project-URL: Homepage, https://github.com/MarkoSterk/Patera
24
+ Project-URL: Documentation, https://github.com/MarkoSterk/Patera#readme
25
+ Project-URL: Repository, https://github.com/MarkoSterk/Patera
26
+ Project-URL: Issues, https://github.com/MarkoSterk/Patera/issues
27
+ Project-URL: Changelog, https://github.com/MarkoSterk/Patera/blob/main/CHANGELOG.md
28
+ Description-Content-Type: text/markdown
29
+
30
+ # patera-apiinterface
31
+
32
+ Declarative async HTTP clients for external APIs in Patera applications. Part of [Patera](https://github.com/MarkoSterk/Patera), a modular async-first Python web framework.
33
+
34
+ ## Installation
35
+
36
+ ```sh
37
+ pip install patera-apiinterface
38
+ # or, with uv
39
+ uv add "patera[apiinterface]"
40
+ ```
41
+
42
+ Requires Python 3.13 or newer and `patera>=0.121`.
43
+
44
+ ## Usage
45
+
46
+ `patera-apiinterface` turns annotated methods into HTTP calls (with [HTTPX](https://www.python-httpx.org)):
47
+
48
+ ```python
49
+ from patera import HttpMethod
50
+ from patera.apiinterface import ApiInterface, AuthType, auth, headers, method, resource, service, timeout
51
+
52
+
53
+ @service("GITHUB_URL") # config key or literal URL
54
+ @auth(AuthType.BEARER, token="GITHUB_TOKEN") # config key or literal value
55
+ @headers({"X-Client": "my-app"})
56
+ @timeout(10)
57
+ class GithubApi(ApiInterface):
58
+
59
+ @method(HttpMethod.GET)
60
+ @resource("/repos/<repo_id>") # filled from the argument of the same name
61
+ async def get_repo(self, repo_id: int) -> Repo: ... # Pydantic return types are validated
62
+
63
+ @method(HttpMethod.POST)
64
+ @resource("/repos")
65
+ async def create_repo(self, name: str, private: bool) -> dict: ... # arguments become the JSON body
66
+ ```
67
+
68
+ See the [External APIs section of the Patera documentation](https://github.com/MarkoSterk/Patera#external-apis) for the full guide.
69
+
70
+ ## License
71
+
72
+ MIT. See [LICENSE](https://github.com/MarkoSterk/Patera/blob/main/LICENSE).
@@ -0,0 +1,43 @@
1
+ # patera-apiinterface
2
+
3
+ Declarative async HTTP clients for external APIs in Patera applications. Part of [Patera](https://github.com/MarkoSterk/Patera), a modular async-first Python web framework.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ pip install patera-apiinterface
9
+ # or, with uv
10
+ uv add "patera[apiinterface]"
11
+ ```
12
+
13
+ Requires Python 3.13 or newer and `patera>=0.121`.
14
+
15
+ ## Usage
16
+
17
+ `patera-apiinterface` turns annotated methods into HTTP calls (with [HTTPX](https://www.python-httpx.org)):
18
+
19
+ ```python
20
+ from patera import HttpMethod
21
+ from patera.apiinterface import ApiInterface, AuthType, auth, headers, method, resource, service, timeout
22
+
23
+
24
+ @service("GITHUB_URL") # config key or literal URL
25
+ @auth(AuthType.BEARER, token="GITHUB_TOKEN") # config key or literal value
26
+ @headers({"X-Client": "my-app"})
27
+ @timeout(10)
28
+ class GithubApi(ApiInterface):
29
+
30
+ @method(HttpMethod.GET)
31
+ @resource("/repos/<repo_id>") # filled from the argument of the same name
32
+ async def get_repo(self, repo_id: int) -> Repo: ... # Pydantic return types are validated
33
+
34
+ @method(HttpMethod.POST)
35
+ @resource("/repos")
36
+ async def create_repo(self, name: str, private: bool) -> dict: ... # arguments become the JSON body
37
+ ```
38
+
39
+ See the [External APIs section of the Patera documentation](https://github.com/MarkoSterk/Patera#external-apis) for the full guide.
40
+
41
+ ## License
42
+
43
+ MIT. See [LICENSE](https://github.com/MarkoSterk/Patera/blob/main/LICENSE).
@@ -0,0 +1,51 @@
1
+ [project]
2
+ name = "patera-apiinterface"
3
+ version = "0.11.0"
4
+ description = "Declarative async HTTP clients for external APIs in Patera applications"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.13"
9
+ keywords = [
10
+ "patera",
11
+ "http",
12
+ "client",
13
+ "api",
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Framework :: AsyncIO",
18
+ "Intended Audience :: Developers",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3 :: Only",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Programming Language :: Python :: 3.14",
24
+ "Typing :: Typed",
25
+ "Topic :: Internet :: WWW/HTTP",
26
+ ]
27
+ dependencies = [
28
+ "httpx>=0.28.1",
29
+ "patera>=0.121",
30
+ ]
31
+
32
+ [[project.authors]]
33
+ name = "Marko Šterk"
34
+ email = "marko_sterk@hotmail.com"
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/MarkoSterk/Patera"
38
+ Documentation = "https://github.com/MarkoSterk/Patera#readme"
39
+ Repository = "https://github.com/MarkoSterk/Patera"
40
+ Issues = "https://github.com/MarkoSterk/Patera/issues"
41
+ Changelog = "https://github.com/MarkoSterk/Patera/blob/main/CHANGELOG.md"
42
+
43
+ [tool.uv.sources.patera]
44
+ workspace = true
45
+
46
+ [tool.uv.build-backend]
47
+ module-name = "patera.apiinterface"
48
+
49
+ [build-system]
50
+ requires = ["uv_build>=0.10.9,<0.13.0"]
51
+ build-backend = "uv_build"
@@ -0,0 +1,48 @@
1
+ [project]
2
+ name = "patera-apiinterface"
3
+ version = "0.11.0"
4
+ description = "Declarative async HTTP clients for external APIs in Patera applications"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [{ name = "Marko Šterk", email = "marko_sterk@hotmail.com" }]
9
+ requires-python = ">=3.13"
10
+ keywords = [
11
+ "patera",
12
+ "http",
13
+ "client",
14
+ "api",
15
+ ]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Framework :: AsyncIO",
19
+ "Intended Audience :: Developers",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3 :: Only",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Programming Language :: Python :: 3.14",
25
+ "Typing :: Typed",
26
+ "Topic :: Internet :: WWW/HTTP",
27
+ ]
28
+ dependencies = [
29
+ "httpx>=0.28.1",
30
+ "patera>=0.121",
31
+ ]
32
+
33
+ [project.urls]
34
+ Homepage = "https://github.com/MarkoSterk/Patera"
35
+ Documentation = "https://github.com/MarkoSterk/Patera#readme"
36
+ Repository = "https://github.com/MarkoSterk/Patera"
37
+ Issues = "https://github.com/MarkoSterk/Patera/issues"
38
+ Changelog = "https://github.com/MarkoSterk/Patera/blob/main/CHANGELOG.md"
39
+
40
+ [tool.uv.sources]
41
+ patera = { workspace = true }
42
+
43
+ [tool.uv.build-backend]
44
+ module-name = "patera.apiinterface"
45
+
46
+ [build-system]
47
+ requires = ["uv_build>=0.10.9,<0.13.0"]
48
+ build-backend = "uv_build"
@@ -0,0 +1,37 @@
1
+ """
2
+ Declarative interfaces for external HTTP APIs.
3
+ """
4
+
5
+ from .api_interface import (
6
+ AuthType,
7
+ service,
8
+ method,
9
+ resource,
10
+ consumes,
11
+ produces,
12
+ headers,
13
+ timeout,
14
+ auth,
15
+ no_auth,
16
+ forward_request,
17
+ MissingApiInterfaceConfigurations,
18
+ ApiInterfaceResponseError,
19
+ ApiInterface,
20
+ )
21
+
22
+ __all__ = [
23
+ "AuthType",
24
+ "service",
25
+ "method",
26
+ "resource",
27
+ "consumes",
28
+ "produces",
29
+ "headers",
30
+ "timeout",
31
+ "auth",
32
+ "no_auth",
33
+ "forward_request",
34
+ "MissingApiInterfaceConfigurations",
35
+ "ApiInterfaceResponseError",
36
+ "ApiInterface",
37
+ ]