Metadata-Version: 2.1
Name: spanish-dni
Version: 1.0.1
Summary: Spanish DNI utilities for NIE/NIF
Home-page: UNKNOWN
Author: Joan Travé
Author-email: jtravegordillo@gmail.com
License: MIT
Project-URL: Source, https://github.com/joanTrave/spanish_dni
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# 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.
```bash
pip install spanish-dni
```
## How to use it
```python3
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")
```

