Skip to main content

Python library for accessing Mimit Fuel Prices API

Project description

mimitFuelPy

A Python library for accessing the Mimit Fuel Prices API. This library provides a clean, object-oriented interface for searching fuel stations and retrieving fuel pricing data in Italy.

๐Ÿ“‹ Table of Contents

Installation

Install mimitfuelpy using pip:

pip install mimitfuelpy

Quick Start

from mimitfuelpy import Client
from mimitfuelpy.models import FuelType, ServiceType, SearchByBrandCriteria

# Initialize the client
client = Client()

# Search for fuel stations
criteria = SearchByBrandCriteria(
    province="MI",  # Milan
    priceOrder="asc",
    fuelType=FuelType.PETROL.value,
    serviceType=ServiceType.SELF.value
)

results = client.search.byBrand(criteria)
for station in results.results:
    print(f"{station.name}: {station.address}")

Features

  • ๐Ÿš— Station Search: Find fuel stations by location, brand, highway, or zone
  • ๐Ÿ’ฐ Price Data: Get current fuel prices with filtering options
  • ๐Ÿ—บ๏ธ Geographic Data: Access regions, provinces, towns, and highways
  • ๐Ÿ“Š Flexible Filtering: Filter by fuel type and service type
  • ๐Ÿข Service Areas: Detailed service area information with facilities
  • ๐Ÿ” Easy Integration: Simple, intuitive API design

API Coverage

Registry Operations

  • Get all brands and their logos
  • Get highways information
  • Get regions, provinces, and towns hierarchy
  • Get detailed service area information with services and hours

Search Operations

  • Search by geographic zone
  • Search by administrative area (province)
  • Search by highway
  • Search by brand with comprehensive filtering criteria

Documentation

๐Ÿ“– Complete documentation is available at: https://fpetranzan.github.io/mimitFuelPy/

The documentation includes:

Documentation Development

The documentation is built using Jekyll with the "just-the-docs" theme and is automatically deployed to GitHub Pages.

Local Documentation Development

# Install Ruby dependencies
bundle install

# Serve documentation locally
bundle exec jekyll serve

# View at http://localhost:4000

Documentation Structure

docs/
โ”œโ”€โ”€ index.md              # Homepage
โ”œโ”€โ”€ installation.md       # Installation guide
โ”œโ”€โ”€ quick-start.md        # Quick start guide
โ”œโ”€โ”€ api/                  # API Reference
โ”‚   โ”œโ”€โ”€ index.md
โ”‚   โ”œโ”€โ”€ client.md
โ”‚   โ”œโ”€โ”€ registry.md
โ”‚   โ””โ”€โ”€ models.md
โ”œโ”€โ”€ examples/             # Code examples
โ”‚   โ”œโ”€โ”€ index.md
โ”‚   โ””โ”€โ”€ basic-usage.md
โ””โ”€โ”€ guides/               # In-depth guides
    โ”œโ”€โ”€ index.md
    โ””โ”€โ”€ getting-started.md

Examples

Basic Usage

from mimitfuelpy import Client

client = Client()

# Get all brands
brands = client.registry.brands()
print(f"Found {len(brands)} fuel brands")

# Get regions
regions = client.registry.regions()
print(f"Italy has {len(regions)} regions")

Advanced Search

from mimitfuelpy.models import SearchByBrandCriteria, FuelType

# Find cheapest diesel stations in Rome
criteria = SearchByBrandCriteria(
    province="RM",  # Rome
    fuelType=FuelType.DIESEL.value,
    priceOrder="asc"  # Cheapest first
)

results = client.search.byBrand(criteria)
if results.success:
    print(f"Found {len(results.results)} diesel stations")
    for station in results.results[:5]:
        print(f"- {station.name}: {station.address}")

See the examples/ directory and online documentation for more detailed usage examples.

Development

Setup Development Environment

# Clone the repository
git clone https://github.com/fpetranzan/mimitFuelPy.git
cd mimitFuelPy

# Install in development mode with dev dependencies
pip install -e ".[dev]"

Running Tests

# Run tests
python -m pytest tests/

# Run with coverage
python -m pytest tests/ --cov=src/mimitfuelpy --cov-report=html

Code Quality

# Format code
black src/ tests/

# Sort imports
isort src/ tests/

# Lint code
flake8 src/ tests/

# Type checking
mypy src/

Project Structure

mimitFuelPy/
โ”œโ”€โ”€ src/mimitfuelpy/          # Main package
โ”‚   โ”œโ”€โ”€ api/                  # API modules
โ”‚   โ”œโ”€โ”€ models/               # Data models
โ”‚   โ”œโ”€โ”€ utils/                # Utilities
โ”‚   โ””โ”€โ”€ client.py             # Main client
โ”œโ”€โ”€ tests/                    # Test suite
โ”œโ”€โ”€ examples/                 # Usage examples
โ”œโ”€โ”€ docs/                     # Documentation
โ””โ”€โ”€ .github/workflows/        # CI/CD workflows

Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and add tests
  4. Run the test suite: pytest tests/
  5. Format your code: black src/ tests/
  6. Commit your changes: git commit -m 'Add amazing feature'
  7. Push to the branch: git push origin feature/amazing-feature
  8. Open a Pull Request

Development Guidelines

  • Write tests for new features
  • Follow PEP 8 style guidelines
  • Update documentation for API changes
  • Ensure all tests pass before submitting

Reporting Issues

Please use the GitHub Issues page to report bugs or request features.

License

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


Links:

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

mimitfuelpy-0.2.1.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mimitfuelpy-0.2.1-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file mimitfuelpy-0.2.1.tar.gz.

File metadata

  • Download URL: mimitfuelpy-0.2.1.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for mimitfuelpy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 bf4e4ff806424cf87e2eef6f8ce145ca72c20dedc611a5a545feb2de86f0a958
MD5 8918bcc080b46db05d676b0bca181802
BLAKE2b-256 8897f090fd36f55c3ed920f46e3a97b2ebbcbb898286ca40d1a152104b54e4af

See more details on using hashes here.

File details

Details for the file mimitfuelpy-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: mimitfuelpy-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for mimitfuelpy-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 364cc03f5fdce1e41ea9c867312fb301a070e898e48542c0d6d8d35ea79a4e19
MD5 18df8aa45f373bb581d0283de506d913
BLAKE2b-256 6a0e9ff9005624fa1f8e6d71af78b175e24bad0e2ef788fbac4b70d4e744589a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page