i18n¶
validators.i18n.es_cif(value)
¶
Validate a Spanish CIF.
Each company in Spain prior to 2008 had a distinct CIF and has been discontinued. For more information see wikipedia.org/cif.
The new replacement is to use NIF for absolutely everything. The issue is that there are "types" of NIFs now: company, person [citizen or resident] all distinguished by the first character of the DOI. For this reason we will continue to call CIFs NIFs, that are used for companies.
This validator is based on generadordni.es.
Examples:
>>> es_cif('B25162520')
# Output: True
>>> es_cif('B25162529')
# Output: ValidationError(func=es_cif, args=...)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
DOI string which is to be validated. |
required |
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
New in version 0.13.0.
Source code in /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/validators/i18n/es.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
validators.i18n.es_doi(value)
¶
Validate a Spanish DOI.
A DOI in spain is all NIF / CIF / NIE / DNI -- a digital ID. For more information see wikipedia.org/doi. This validator is based on generadordni.es.
Examples:
>>> es_doi('X0095892M')
# Output: True
>>> es_doi('X0095892X')
# Output: ValidationError(func=es_doi, args=...)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
DOI string which is to be validated. |
required |
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
New in version 0.13.0.
Source code in /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/validators/i18n/es.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
validators.i18n.es_nie(value)
¶
Validate a Spanish NIE.
The NIE is a tax identification number in Spain, known in Spanish as the NIE, or more formally the Número de identidad de extranjero. For more information see wikipedia.org/nie. This validator is based on generadordni.es.
Examples:
>>> es_nie('X0095892M')
# Output: True
>>> es_nie('X0095892X')
# Output: ValidationError(func=es_nie, args=...)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
DOI string which is to be validated. |
required |
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
New in version 0.13.0.
Source code in /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/validators/i18n/es.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
validators.i18n.es_nif(value)
¶
Validate a Spanish NIF.
Each entity, be it person or company in Spain has a distinct NIF. Since we've designated CIF to be a company NIF, this NIF is only for person. For more information see wikipedia.org/nif. This validator is based on generadordni.es.
Examples:
>>> es_nif('26643189N')
# Output: True
>>> es_nif('26643189X')
# Output: ValidationError(func=es_nif, args=...)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
DOI string which is to be validated. |
required |
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
New in version 0.13.0.
Source code in /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/validators/i18n/es.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
validators.i18n.fi_business_id(value)
¶
Validate a Finnish Business ID.
Each company in Finland has a distinct business id. For more information see Finnish Trade Register
Examples:
>>> fi_business_id('0112038-9') # Fast Monkeys Ltd
# Output: True
>>> fi_business_id('1234567-8') # Bogus ID
# Output: ValidationError(func=fi_business_id, ...)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
Business ID string to be validated. |
required |
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
Note
- In version 0.5.0:
- Function renamed from
finnish_business_id
tofi_business_id
- Function renamed from
New in version 0.4.0.
Source code in /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/validators/i18n/fi.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
validators.i18n.fi_ssn(value, /, *, allow_temporal_ssn=True)
¶
Validate a Finnish Social Security Number.
This validator is based on django-localflavor-fi.
Examples:
>>> fi_ssn('010101-0101')
# Output: True
>>> fi_ssn('101010-0102')
# Output: ValidationError(func=fi_ssn, args=...)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
Social Security Number to be validated. |
required |
allow_temporal_ssn |
bool
|
Whether to accept temporal SSN numbers. Temporal SSN numbers are the ones where the serial is in the range [900-999]. By default temporal SSN numbers are valid. |
True
|
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
New in version 0.5.0.
Source code in /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/validators/i18n/fi.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
validators.i18n.fr_department(value)
¶
Validate a french department number.
Examples:
>>> fr_department(20) # can be an integer
# Output: True
>>> fr_department("20")
# Output: True
>>> fr_department("971") # Guadeloupe
# Output: True
>>> fr_department("00")
# Output: ValidationError(func=fr_department, args=...)
>>> fr_department('2A') # Corsica
# Output: True
>>> fr_department('2B')
# Output: True
>>> fr_department('2C')
# Output: ValidationError(func=fr_department, args=...)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
Union[str, int]
|
French department number to validate. |
required |
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
New in version 0.23.0.
Source code in /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/validators/i18n/fr.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
validators.i18n.fr_ssn(value)
¶
Validate a french Social Security Number.
Each french citizen has a distinct Social Security Number. For more information see French Social Security Number (sadly unavailable in english).
Examples:
>>> fr_ssn('1 84 12 76 451 089 46')
# Output: True
>>> fr_ssn('1 84 12 76 451 089') # control key is optional
# Output: True
>>> fr_ssn('3 84 12 76 451 089 46') # wrong gender number
# Output: ValidationError(func=fr_ssn, args=...)
>>> fr_ssn('1 84 12 76 451 089 47') # wrong control key
# Output: ValidationError(func=fr_ssn, args=...)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
French Social Security Number string to validate. |
required |
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
New in version 0.23.0.
Source code in /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/validators/i18n/fr.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|