From a01aa548c9e338b6563c041b5d2c8e9950314632 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 29 Sep 2024 19:41:26 +0200 Subject: [PATCH] Adding a version route --- boaviztapi/routers/utils_router.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/boaviztapi/routers/utils_router.py b/boaviztapi/routers/utils_router.py index d5d08be9..7a682b71 100644 --- a/boaviztapi/routers/utils_router.py +++ b/boaviztapi/routers/utils_router.py @@ -1,7 +1,7 @@ import os -import os import pandas as pd +import toml from fastapi import APIRouter, Query from boaviztapi.dto.component.cpu import CPU @@ -23,6 +23,12 @@ _ram_manuf = pd.read_csv(os.path.join(data_dir, 'crowdsourcing/ram_manufacture.csv')) + +@utils_router.get('/version', description="Get the version of the API") +async def version(): + return toml.loads(open(os.path.join(os.path.dirname(__file__), '../../pyproject.toml'), 'r').read())['tool']['poetry'][ + 'version'] + @utils_router.get('/country_code', description=country_code) async def utils_get_all_countries(): return get_available_countries()