pytrain-ogr-api 2.8.0__tar.gz → 2.8.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.
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/PKG-INFO +2 -2
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/pyproject.toml +1 -1
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/requirements.txt +2 -2
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/_version.py +3 -3
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/endpoints.py +8 -5
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_ogr_api.egg-info/PKG-INFO +2 -2
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_ogr_api.egg-info/requires.txt +1 -1
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_ogr_api.egg-info/scm_version.json +2 -2
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/tests/requirements.txt +1 -1
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/.github/workflows/pypi-release.yml +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/.github/workflows/python-package.yml +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/.gitignore +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/AUTHORS +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/LICENSE +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/README.md +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/cli/__init__.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/cli/make_api_service.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/cli/pytrain_api.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/dev.env +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/pytest.ini +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/pytrain-api-docs/index.html +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/pytrain-api-docs/openapi.json +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/ruff.toml +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/setup.cfg +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/__init__.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/__init__.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/make_api_service.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/pytrain_api.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/pytrain_component.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/pytrain_info.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/response_models.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/static/apple-touch-icon.png +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/static/favicon.ico +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/static/pytrain_api.bash.template +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/static/pytrain_api.service.template +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_ogr_api.egg-info/SOURCES.txt +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_ogr_api.egg-info/dependency_links.txt +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_ogr_api.egg-info/entry_points.txt +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_ogr_api.egg-info/scm_file_list.json +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_ogr_api.egg-info/top_level.txt +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/tests/__init__.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/tests/pytrain_api/__init__.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/tests/pytrain_api/test_pytrain_api.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/tests/pytrain_api/test_pytrain_component.py +0 -0
- {pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytrain-ogr-api
|
|
3
|
-
Version: 2.8.
|
|
3
|
+
Version: 2.8.2
|
|
4
4
|
Summary: Restful API to control Lionel TMCC/Legacy engines, switches, and accesseries from a Raspberry Pi
|
|
5
5
|
Author-email: Dave Swindell <pytraininfo@gmail.com>
|
|
6
6
|
License: GNU LESSER GENERAL PUBLIC LICENSE
|
|
@@ -190,7 +190,7 @@ Description-Content-Type: text/markdown
|
|
|
190
190
|
License-File: LICENSE
|
|
191
191
|
License-File: AUTHORS
|
|
192
192
|
Requires-Dist: pytrain-ogr>=2.8.0
|
|
193
|
-
Requires-Dist: fastapi
|
|
193
|
+
Requires-Dist: fastapi<0.137.0
|
|
194
194
|
Requires-Dist: fastapi-utils>=0.8.0
|
|
195
195
|
Requires-Dist: pyjwt>=2.13.0
|
|
196
196
|
Requires-Dist: python-dotenv>=1.2.2
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '2.8.
|
|
22
|
-
__version_tuple__ = version_tuple = (2, 8,
|
|
21
|
+
__version__ = version = '2.8.2'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 8, 2)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'g6b33c668c'
|
|
@@ -27,13 +27,15 @@ from fastapi_utils.cbv import cbv
|
|
|
27
27
|
from jwt import DecodeError, ExpiredSignatureError, InvalidSignatureError, InvalidTokenError
|
|
28
28
|
from pydantic import BaseModel, ValidationError
|
|
29
29
|
from pytrain import (
|
|
30
|
+
PROGRAM_NAME,
|
|
30
31
|
CommandReq,
|
|
31
32
|
CommandScope,
|
|
32
|
-
PROGRAM_NAME,
|
|
33
33
|
TMCC1AuxCommandEnum,
|
|
34
34
|
TMCC1HaltCommandEnum,
|
|
35
35
|
TMCC1RouteCommandEnum,
|
|
36
36
|
TMCC2EngineCommandEnum,
|
|
37
|
+
)
|
|
38
|
+
from pytrain import (
|
|
37
39
|
get_version as pytrain_get_version,
|
|
38
40
|
)
|
|
39
41
|
from pytrain.protocol.command_def import CommandDefEnum
|
|
@@ -223,7 +225,7 @@ def create_secret(length: int = 32) -> str:
|
|
|
223
225
|
def get_api_token(api_key: str = Security(api_key_header)) -> bool:
|
|
224
226
|
"""
|
|
225
227
|
Accepts either:
|
|
226
|
-
1) Raw API key (API_TOKEN, API_KEYS, etc.)
|
|
228
|
+
1) Raw API key (API_TOKEN, API_KEYS, etc.) OR
|
|
227
229
|
2) A JWT (Authorization-style bearer token) signed with SECRET_KEY.
|
|
228
230
|
|
|
229
231
|
Returns True if authorized, otherwise raises HTTPException.
|
|
@@ -619,7 +621,7 @@ async def favicon():
|
|
|
619
621
|
# noinspection PyUnusedLocal
|
|
620
622
|
@app.exception_handler(StarletteHTTPException)
|
|
621
623
|
async def http_exception_handler(request: Request, exc: StarletteHTTPException):
|
|
622
|
-
# allow
|
|
624
|
+
# allow APIs that issue a legitimate 404 to send a 404 response
|
|
623
625
|
if exc.status_code in [404] and (not exc.headers or exc.headers.get("X-Error", None) not in {"404"}):
|
|
624
626
|
return JSONResponse(content={"detail": "Forbidden"}, status_code=403)
|
|
625
627
|
return JSONResponse(content={"detail": exc.detail}, status_code=exc.status_code)
|
|
@@ -891,6 +893,7 @@ async def get_version() -> VersionResponse:
|
|
|
891
893
|
raise HTTPException(status_code=400, detail=str(e))
|
|
892
894
|
|
|
893
895
|
|
|
896
|
+
# noinspection PathParameterInspection
|
|
894
897
|
@router.post(
|
|
895
898
|
"/{component}/{tmcc_id:int}/cli_req",
|
|
896
899
|
summary=f"Send {PROGRAM_NAME} CLI command",
|
|
@@ -1184,7 +1187,7 @@ async def get_blocks(contains: str = None) -> list[BlockInfo]:
|
|
|
1184
1187
|
class Block(PyTrainComponent):
|
|
1185
1188
|
# noinspection PyTypeHints
|
|
1186
1189
|
@classmethod
|
|
1187
|
-
def id_path(cls, label: str = None, min_val: int = 1, max_val: int = 99)
|
|
1190
|
+
def id_path(cls, label: str = None, min_val: int = 1, max_val: int = 99):
|
|
1188
1191
|
label = label if label else cls.__name__.replace("PyTrain", "")
|
|
1189
1192
|
return Path(
|
|
1190
1193
|
title="Block ID",
|
|
@@ -1206,7 +1209,7 @@ class Block(PyTrainComponent):
|
|
|
1206
1209
|
)
|
|
1207
1210
|
async def get_block(
|
|
1208
1211
|
self,
|
|
1209
|
-
block_id: Annotated[int,
|
|
1212
|
+
block_id: Annotated[int, id_path(label="Block")],
|
|
1210
1213
|
) -> BlockInfo:
|
|
1211
1214
|
return BlockInfo(**super().get(block_id))
|
|
1212
1215
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytrain-ogr-api
|
|
3
|
-
Version: 2.8.
|
|
3
|
+
Version: 2.8.2
|
|
4
4
|
Summary: Restful API to control Lionel TMCC/Legacy engines, switches, and accesseries from a Raspberry Pi
|
|
5
5
|
Author-email: Dave Swindell <pytraininfo@gmail.com>
|
|
6
6
|
License: GNU LESSER GENERAL PUBLIC LICENSE
|
|
@@ -190,7 +190,7 @@ Description-Content-Type: text/markdown
|
|
|
190
190
|
License-File: LICENSE
|
|
191
191
|
License-File: AUTHORS
|
|
192
192
|
Requires-Dist: pytrain-ogr>=2.8.0
|
|
193
|
-
Requires-Dist: fastapi
|
|
193
|
+
Requires-Dist: fastapi<0.137.0
|
|
194
194
|
Requires-Dist: fastapi-utils>=0.8.0
|
|
195
195
|
Requires-Dist: pyjwt>=2.13.0
|
|
196
196
|
Requires-Dist: python-dotenv>=1.2.2
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/static/pytrain_api.bash.template
RENAMED
|
File without changes
|
{pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_api/static/pytrain_api.service.template
RENAMED
|
File without changes
|
|
File without changes
|
{pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_ogr_api.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_ogr_api.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{pytrain_ogr_api-2.8.0 → pytrain_ogr_api-2.8.2}/src/pytrain_ogr_api.egg-info/scm_file_list.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|