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.1.0.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.1.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mimitfuelpy-0.1.0.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.1.0.tar.gz
Algorithm Hash digest
SHA256 1c6a8b7275a718ef96ee17100640b3a9fe57fbbb3f5c4795b2281d0b4897811a
MD5 31e5d2c07299ff46c5c57a9c83ec888f
BLAKE2b-256 2d5ffb45ba3992f0ac603f9ae157c3f089d43c61b7bbde03bbb32df1516c463f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mimitfuelpy-0.1.0-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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f747b20af07a1c1b58bb17abf5c5039a9a614c4e0059ec8560638c3dec68af0
MD5 53ea1b4dd7cd568efd82d82900c421eb
BLAKE2b-256 138462947ecc451d2616a9054362c5aeca01d54139a061485225b31e26f528cf

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