Registry
Table of contents
The Registry class provides access to reference data including brands, geographic locations, and service area details. It’s accessed through the client.registry property.
Methods
brands() -> List[Brand]
Retrieves the list of all available fuel brands.
Returns: List of Brand objects
Example:
brands = client.registry.brands()
for brand in brands:
print(f"Brand: {brand.name} (ID: {brand.id})")
brands_logos() -> List[Logo]
Retrieves the list of all brand logos.
Returns: List of Logo objects containing logo information
Example:
logos = client.registry.brands_logos()
for logo in logos:
print(f"Logo for {logo.brand}: {logo.url}")
highways() -> List[Highway]
Retrieves the list of all highways in Italy.
Returns: List of Highway objects
Example:
highways = client.registry.highways()
for highway in highways:
print(f"Highway: {highway.name} (Code: {highway.code})")
regions() -> List[Region]
Retrieves the list of all Italian regions.
Returns: List of Region objects
Example:
regions = client.registry.regions()
for region in regions:
print(f"Region: {region.name} (ID: {region.id})")
provinces(region_id) -> List[Province]
Retrieves the list of provinces for a specific region.
Parameters:
region_id(str): The region ID
Returns: List of Province objects
Example:
# Get provinces for Lombardy (region ID "03")
lombardy_provinces = client.registry.provinces("03")
for province in lombardy_provinces:
print(f"Province: {province.name} (ID: {province.id})")
towns(province_id) -> List[Town]
Retrieves the list of towns for a specific province.
Parameters:
province_id(str): The province ID
Returns: List of Town objects
Example:
# Get towns for Milan province (ID "015")
milan_towns = client.registry.towns("015")
for town in milan_towns:
print(f"Town: {town.name} (ID: {town.id})")
service_area(service_area_id) -> ServiceAreaDetail
Retrieves detailed information about a specific service area.
Parameters:
service_area_id(str): The service area ID
Returns: ServiceAreaDetail object with complete information
Example:
details = client.registry.service_area("12345")
print(f"Service Area: {details.name}")
print(f"Address: {details.address}")
print(f"Brand: {details.brand}")
print(f"Phone: {details.phoneNumber}")
print(f"Services: {len(details.services)}")
print(f"Opening hours: {len(details.orariapertura)} time slots")
Data Models
Brand
Represents a fuel brand.
Attributes:
id(str): Brand identifiername(str): Brand name
Logo
Represents brand logo information.
Attributes:
brand(str): Brand nameurl(str): Logo image URLimages(List): Available image formats
Highway
Represents a highway.
Attributes:
id(str): Highway identifiername(str): Highway namecode(str): Highway code
Region
Represents an Italian region.
Attributes:
id(str): Region identifiername(str): Region name
Province
Represents a province within a region.
Attributes:
id(str): Province identifiername(str): Province namecode(str): Province code
Town
Represents a town within a province.
Attributes:
id(str): Town identifiername(str): Town name
ServiceAreaDetail
Detailed information about a service area.
Attributes:
id(str): Service area identifiername(str): Service area namenomeImpianto(str): Plant nameaddress(str): Full addressbrand(str): Associated brandfuels(List[Fuel]): Available fuels and pricesphoneNumber(str): Contact phone numberemail(str): Contact emailwebsite(str): Website URLcompany(str): Operating companyservices(List[ServiceAreaService]): Available servicesorariapertura(List[OpeningHour]): Opening hours
Usage Patterns
Geographic Hierarchy Navigation
# Navigate the geographic hierarchy
regions = client.registry.regions()
print(f"Italy has {len(regions)} regions")
# Get provinces for first region
first_region = regions[0]
provinces = client.registry.provinces(first_region.id)
print(f"{first_region.name} has {len(provinces)} provinces")
# Get towns for first province
first_province = provinces[0]
towns = client.registry.towns(first_province.id)
print(f"{first_province.name} has {len(towns)} towns")
Service Area Information
# Get detailed service area information
service_area_id = "12345" # From search results
details = client.registry.service_area(service_area_id)
print(f"Service Area: {details.name}")
print(f"Brand: {details.brand}")
print(f"Address: {details.address}")
# Check available services
if details.services:
print("Available services:")
for service in details.services:
print(f" - {service.name}")
# Check fuel prices
if details.fuels:
print("Fuel prices:")
for fuel in details.fuels:
print(f" - {fuel.name}: €{fuel.price}")
# Check opening hours
if details.orariapertura:
print("Opening hours:")
for hours in details.orariapertura:
print(f" - {hours.day}: {hours.opening_time} - {hours.closing_time}")
Brand Information
# Get all brands and their logos
brands = client.registry.brands()
logos = client.registry.brands_logos()
# Create brand-logo mapping
brand_logos = {}
for logo in logos:
brand_logos[logo.brand] = logo.url
# Display brands with logos
for brand in brands:
logo_url = brand_logos.get(brand.name, "No logo available")
print(f"{brand.name}: {logo_url}")