stdnum.fr.siren

SIREN (a French company identification number).

The SIREN (Système d’Identification du Répertoire des Entreprises) is a 9 digit number used to identify French companies. The Luhn checksum is used to validate the numbers.

>>> compact('552 008 443')
'552008443'
>>> validate('404833048')
'404833048'
>>> validate('404833047')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> to_tva('443 121 975')
'46 443 121 975'
stdnum.fr.siren.compact(number)

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

stdnum.fr.siren.is_valid(number)

Check if the number provided is a valid SIREN.

stdnum.fr.siren.to_tva(number)

Return a TVA that prepends the two extra check digits to the SIREN.

stdnum.fr.siren.validate(number)

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