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.0.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for spanish_dni-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbd18a0c43ea86e8d97a3ea3f43b2e0c11fa0f89757f311d1288611660d83eb2 |
|
MD5 | 1b6432f6fcda14ac9b417c7795ee8348 |
|
BLAKE2b-256 | ecfd04dd819773a07d5af448e16c2b5f20ab8bc0c2557e8add1fb49d049cd7b9 |