diff --git a/ton-http-api/pyTON/main.py b/ton-http-api/pyTON/main.py index f4eed7c..b36f141 100644 --- a/ton-http-api/pyTON/main.py +++ b/ton-http-api/pyTON/main.py @@ -101,10 +101,12 @@ def main_config(binder): settings = inject.instance(Settings) +pkg_version = '2.0.0' + app = FastAPI( title="TON HTTP API", description=description, - version='2.0.0', + version=pkg_version, docs_url='/', responses={ 422: {'description': 'Validation Error'}, @@ -138,6 +140,14 @@ async def startup(): async def shutdown_event(): await tonlib.shutdown() + +@app.middleware("http") +async def add_process_time_header(request: Request, call_next): + response = await call_next(request) + response.headers["X-API-Version"] = pkg_version + return response + + # Exception handlers @app.exception_handler(StarletteHTTPException) async def http_exception_handler(request, exc): diff --git a/ton-http-api/requirements.txt b/ton-http-api/requirements.txt index 8fb3b52..2272a89 100644 --- a/ton-http-api/requirements.txt +++ b/ton-http-api/requirements.txt @@ -6,5 +6,5 @@ requests==2.28.0 ring==0.10.1 uvicorn==0.17.6 gunicorn==20.1.0 -pytonlib==0.0.67 +pytonlib==0.0.68 inject==4.3.1 diff --git a/ton-http-api/setup.py b/ton-http-api/setup.py index a2ac871..533687a 100644 --- a/ton-http-api/setup.py +++ b/ton-http-api/setup.py @@ -24,7 +24,7 @@ 'ring==0.10.1', 'uvicorn==0.17.6', 'gunicorn==20.1.0', - 'pytonlib==0.0.67', + 'pytonlib==0.0.68', 'inject==4.3.1' ], package_data={},