Spanish DNI utilities for NIE/NIF
Project description
Spanish DNI
SD is a library of utilities for the Python programming language that allows validating both NIE and NIF.
Installation
Can be installed via PiPI.
pip install spanish-dni
How to use it
from typing import List
from spanish_dni.dni import DNI
from spanish_dni.exceptions import NotValidDNIException
from spanish_dni.validator import validate_dni
my_dnis: List[str] = [
"23414538D",
"Y2853959H",
"23418D",
"U2853959H",
"23414538T",
]
for dni in my_dnis:
valid = True
try:
dni_parsed: DNI = validate_dni(dni)
print(f"DNI {dni} is type {dni_parsed.dni_type}")
except NotValidDNIException:
valid = False
print(f"DNI {dni} is not valid")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
spanish-dni-1.0.1.tar.gz
(2.5 kB
view hashes)
Built Distribution
Close
Hashes for spanish_dni-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36fcb4024ad7fef2ac0f8dc805a0fe103780fdc6ea5acdbf1b9de6a551a495f4 |
|
MD5 | 4a3802f32be3c72c2d5a2bbf7b3417c7 |
|
BLAKE2b-256 | f1202e08f795339f791fc7da2b19e7d0e62054b6643b8ab1c39cc1ba0ad0db21 |