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 number to the standard presentation format.

stdnum.fr.siret.is_valid(number)

Check if the number is a valid SIRET.

stdnum.fr.siret.to_siren(number)

Convert the SIRET number to a SIREN number.

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

stdnum.fr.siret.to_tva(number)

Convert the SIRET number to a TVA number.

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

stdnum.fr.siret.validate(number)

Check if the number is a valid SIRET. This checks the length, formatting and check digit.