Sign inSign up

sinanerdinc/opet

By sinanerdinc

•Updated over 1 year ago

A Python package that allows you to view fuel prices in Turkey based on cities.

Image
0

490

sinanerdinc/opet repository overview

⁠Opet Fuel Prices API & CLI

A Python package that provides both CLI and API interfaces to fetch current fuel prices from Opet's website.

⁠Features

  • �� Fetch current fuel prices for any province in Turkey
  • 🖥️ Command-line interface for quick access
  • 🌐 REST API for integration with other applications
  • 🐳 Docker support for easy deployment

⁠Quick Start

⁠Using Docker
⁠CLI Usage
# Get fuel prices for Istanbul (34)
docker run sinanerdinc/opet cli --il 34
⁠API Usage
# Run API server on default port (8000)
docker run -p 8000:8000 sinanerdinc/opet api

# Or map to a different port
docker run -p 5050:8000 sinanerdinc/opet api
⁠Using Python Package
from opet.api import OpetApiClient

# Initialize client
client = OpetApiClient()

# Get list of provinces
provinces = client.get_provinces()

# Get fuel prices for a specific province
prices = client.get_price("34")  # Istanbul

⁠API Endpoints

The API server provides the following endpoints:

  • GET /provinces - List all available provinces
  • GET /prices/{province_id} - Get fuel prices for a specific province
  • GET /lastupdate - Get the last update time

⁠Port Mapping

  • The API server runs on port 8000 inside the container
  • You can map this to any port on your host machine using Docker's -p flag
  • Example: -p 5050:8000 maps container's port 8000 to host's port 5050

⁠Development

⁠Building from Source
# Clone the repository
git clone https://github.com/sinanerdinc/opet.git

# Build Docker image
docker build -t opet .
⁠Running Tests
# Run tests using pytest
pytest

⁠License

This project is licensed under the MIT License - see the LICENSE⁠ file for details.

⁠Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

⁠Author

Tag summary

Content type

Image

Digest

sha256:ea0da1dbd…

Size

70.4 MB

Last updated

over 1 year ago

docker pull sinanerdinc/opet