stdnum.fr.siret

SIRET (a French company establishment identification number).

The SIRET (Système d’Identification du Répertoire des ETablissements) is a 14 digit number used to identify French companies’ establishments and facilities. The Luhn checksum is used to validate the numbers.

>>> validate('73282932000074')
'73282932000074'
>>> validate('73282932000079')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> to_siren('732 829 320 00074')
'732 829 320'
>>> to_siren('73282932000074')
'732829320'
>>> to_tva('732 829 320 00074')
'44 732 829 320'
>>> to_tva('73282932000074')
'44732829320'
>>> format('73282932000074')
'732 829 320 00074'
stdnum.fr.siret.compact(number)

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.fr.siret.format(number, separator=' ')

Reformat the passed number to the standard format.

stdnum.fr.siret.is_valid(number)

Checks to see if the number provided is a valid number. This checks the length, formatting and check digit.

stdnum.fr.siret.to_siren(number)

Return SIREN number from the given SIRET number.

The SIREN number is the 9 first digits of the SIRET number.

stdnum.fr.siret.to_tva(number)

Return TVA number from the given SIRET number.

The TVA number is built from the SIREN number, prepended by two extra error checking digits.

stdnum.fr.siret.validate(number)

Checks to see if the number provided is a valid number. This checks the length, formatting and check digit.