BDZMS is a Python microservice that wraps the BDZ.bg API, providing endpoints to fetch data related to the Bulgarian state railway company BDZ. This microservice uses FastAPI and utilizes the ms_core library, which is a toolkit I wrote for building HTTP microservices with FastAPI, Pydantic, and TortoiseORM.
This service is part of the transport tracking platform, integrating with the BurgasBusMS for a complete transport tracking solution.
- Wraps BDZ.bg API to provide railway data such as train schedules, routes, and station information.
- Built with FastAPI for fast, asynchronous handling of HTTP requests.
- Integrated with ms_core for simplified microservice development.
- Uses TortoiseORM with asyncpg for efficient database handling.
FastAPI, Pydantic, TortoiseORM, ms_core, asyncpg, uvicorn, aiohttp
-
Install dependencies:
pip install -r requirements.txt
-
Start the microservice:
uvicorn main:app --reload
-
Build for production:
uvicorn main:app --host 0.0.0.0 --port 8000
The microservice will be accessible at http://localhost:8000 by default.
The microservice handles API requests through FastAPI endpoints, processes them, and communicates with external services using aiohttp. It uses ms_core for simplified interactions with databases and external APIs.
- The microservice includes unit tests to ensure data processing and API communication work correctly. You can run tests using
pytest.
You can also explore the frontend of this project here: WiseFrontendLegacy.