This project allows you to fetch current fuel prices from https://www.opet.com.tr/.
The project also has an mcp server, you can access it from https://github.com/sinanerdinc/opet-mcp
You can install the package using the following command:
pip install opet
You can use the project as a library or via the CLI.
from opet.api import OpetApiClient
client = OpetApiClient()
print(client.get_provinces())
print(client.get_price("55"))You can view fuel prices in JSON format by passing the plate code as a parameter:
opet-cli --il 34
You can also start the API server directly using the CLI:
opet-cli --api
This will start the API server on port 8000, and you can access it at http://localhost:8000.
- get_last_update: Returns the last update time.
- get_provinces: Returns the list of provinces and their codes.
- price: Returns fuel prices for a given province code.
This project includes unit tests written using pytest to ensure code quality and reliability. Tests are automatically run on every code change and on pull requests to the main branch via GitHub Actions.
You can use the application via Docker. You can build your own image using the Dockerfile:
docker build -t opet .
Alternatively, you can use the pre-built image from Docker Hub:
docker pull sinanerdinc/opet
To run the CLI using Docker, use the following command:
docker run opet cli --il 34
To run the API server using Docker, use the following command:
docker run -p 8000:8000 opet api
This will start the API server on port 8000, and you can access it at http://localhost:8000.
You can also map the container's port 8000 to a different port on your host machine:
docker run -p 5050:8000 opet api
In this case, the API server still runs on port 8000 inside the container, but you can access it at http://localhost:5050 on your host machine.