This project provides a FastAPI-based backend and a simple user interface for converting various physical units to units representing the mass, length, width, height, area, and power of a Škoda Fabia 1.2 HTP.
-
Clone the repository:
git clone <repository-url> cd fabia_converter
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Run the FastAPI application:
uvicorn main:app --reload
Convert mass to Škoda Fabia 1.2 HTP units.
- Endpoint:
/convert/mass/{mass} - Method:
GET - Parameters:
mass(float, path): The mass to convert (default example: 400).unit(str, query): The unit of the mass (default: kg).
- Example:
curl -X 'GET' 'http://127.0.0.1:8000/convert/mass/400?unit=kg' -H 'accept: application/json'
Convert length to Škoda Fabia 1.2 HTP units.
- Endpoint:
/convert/length/{length} - Method:
GET - Parameters:
length(float, path): The length to convert.unit(str, query): The unit of the length (default: m).
- Example:
curl -X 'GET' 'http://127.0.0.1:8000/convert/length/100?unit=m' -H 'accept: application/json'
Convert width to Škoda Fabia 1.2 HTP units.
- Endpoint:
/convert/width/{width} - Method:
GET - Parameters:
width(float, path): The width to convert.unit(str, query): The unit of the width (default: m).
- Example:
curl -X 'GET' 'http://127.0.0.1:8000/convert/width/50?unit=m' -H 'accept: application/json'
Convert height to Škoda Fabia 1.2 HTP units.
- Endpoint:
/convert/height/{height} - Method:
GET - Parameters:
height(float, path): The height to convert.unit(str, query): The unit of the height (default: m).
- Example:
curl -X 'GET' 'http://127.0.0.1:8000/convert/height/10?unit=m' -H 'accept: application/json'
Convert area to Škoda Fabia 1.2 HTP units.
- Endpoint:
/convert/area/{area} - Method:
GET - Parameters:
area(float, path): The area to convert.unit(str, query): The unit of the area (default: m2).scenario(str, query): The scenario for the conversion (default: packed, options: packed, parking_lot).
- Example:
curl -X 'GET' 'http://127.0.0.1:8000/convert/area/10000?unit=m2&scenario=packed' -H 'accept: application/json'
Convert power to Škoda Fabia 1.2 HTP units.
- Endpoint:
/convert/power/{power} - Method:
GET - Parameters:
power(float, path): The power to convert.unit(str, query): The unit of the power (default: kW).
- Example:
curl -X 'GET' 'http://127.0.0.1:8000/convert/power/55?unit=kW' -H 'accept: application/json'
Generate the conversion result as an HTML response.
- Endpoint:
/generate - Method:
GET - Parameters:
value(float, query): The value to convert.conversion_type(str, query): The type of conversion (e.g., area, power).unit(str, query): The unit of the value.scenario(str, query, optional): The scenario for the conversion (optional).
- Example:
curl -X 'GET' 'http://127.0.0.1:8000/generate?value=10000&conversion_type=area&unit=m2&scenario=packed' -H 'accept: text/html'
FastAPI provides interactive API documentation using Swagger UI and ReDoc.
- Swagger UI: http://127.0.0.1:8000/docs
- ReDoc: http://127.0.0.1:8000/redoc
This project is licensed under the MIT License.