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

Uploaded Python 3

File details

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

File metadata

  • Download URL: mimitfuelpy-0.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 7655c9d4d5810476db2669f721fe049748fcde2d77717e0ea5c1f4ace787daad
MD5 c4d374c468a10cf3a4ce17b44964cd9d
BLAKE2b-256 4ea54525c5579782aac044e86f19057a50880036c4dd23acbcaf08ac8780969c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mimitfuelpy-0.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b791e8f8bd7c75722f534a8137bf36395ac99b8aa4dbe7138b805a3ba5ecdd77
MD5 fe847887010679d4c300c8c50c5bff09
BLAKE2b-256 617b3a7ce84020f9494ab2b5cc094af2a33d29a512097831f1a76c98cfa83293

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