Skip to content
Snippets Groups Projects
crm.py 519 B
from typing import Any


class CustomerNotFoundError(Exception):
    """Exception raised when a customer is not found."""

    pass


def all_customers() -> list[dict]:
    return [
        {
            "id": "8f0df561-ce9d-4d9c-89a8-7953d3ffc961",
            "name": "GÉANT",
        },
    ]


def get_customer_by_name(name: str) -> dict[str, Any]:
    for customer in all_customers():
        if customer["name"] == name:
            return customer

    raise CustomerNotFoundError(f"Customer {name} not found")