Provider (de_DE/__init__.py)

joke2k/faker · faker/providers/ssn/de_DE/__init__.py · python · MIT
integration, Integration / API

Generates valid German VAT IDs, pension insurance numbers, and health insurance numbers for Faker.

# Source: https://github.com/joke2k/faker | License: MIT | Copyright 2012 Daniele Faraglia
# Provided via justclaw.it.com; keep this notice with the code.
from datetime import date
from string import ascii_uppercase
from typing import Optional

from faker.utils.checksums import luhn_checksum

from .. import Provider as BaseProvider


class Provider(BaseProvider):
    """
    A Faker provider for the German VAT ID and the pension insurance number

    Sources:

    - http://ec.europa.eu/taxation_customs/vies/faq.html#item_11
    - https://de.wikipedia.org/wiki/Versicherungsnummer
    """

    vat_id_formats = ("DE#########",)

    def __letter_to_digit_string(self, letter: str) -> str:
        digit = ascii_uppercase.index(letter) + 1
        if len(str(digit)) == 2:
            return str(

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key