A Python package that allows you to view fuel prices in Turkey based on cities.
Project description
Opet
This project allows you to fetch current fuel prices from https://www.opet.com.tr/.
Installation
You can install the package using the following command:
pip install opet
Usage
You can use the project as a library or via the CLI.
Library Usage
from opet.api import OpetApiClient
client = OpetApiClient()
print(client.get_provinces())
print(client.get_price("55"))
CLI Usage
You can view fuel prices in JSON format by passing the plate code as a parameter:
opet-cli --il 34
Methods
- 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.
Testing
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.
Docker
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
Running CLI with Docker
To run the CLI using Docker, use the following command:
docker run opet cli --il 34
Running API with Docker
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opet-0.1.1.tar.gz.
File metadata
- Download URL: opet-0.1.1.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18d2b5a64a58e3e76a56d1ee67a5621968bc42dfb8e9732c5a2737fc63f090f4
|
|
| MD5 |
b9f1dbd7f92057cb9c7840ba002a57db
|
|
| BLAKE2b-256 |
e6b1845d2af4ef81f58b1c0de0e520452af1eb1ab410a9d8de3c6207be2c3ca0
|
File details
Details for the file opet-0.1.1-py3-none-any.whl.
File metadata
- Download URL: opet-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f76bbbe54e34b12a2849331ed06fb445abd6dd287f479d590f9932fd52ea2efc
|
|
| MD5 |
a219795edcd3b506b422a19fcdd1e55e
|
|
| BLAKE2b-256 |
49d86921541e198c26b2dd9d7a519689fa44cd922cb8f504b9c1f312ca6bd3e4
|