Un module pour lire les informations des cartes d'identité belges
Project description
PythonBEID
PythonBEID est un module Python pour lire les informations essentielles des cartes d'identité belge à l'aide d'un lecteur de cartes PC/SC et de la bibliothèque pyscard.
Installation
pip install pythonbeid
Utilisation
from pythonbeid import CardReader, NoReaderError, NoCardError
try:
with CardReader() as cr: # context manager — ferme proprement la connexion
info = cr.read_informations(photo=False)
print(info["last_name"]) # Smith
print(info["birth_date"]) # datetime(1990, 1, 1)
except NoReaderError:
print("Aucun lecteur de carte détecté.")
except NoCardError:
print("Aucune carte dans le lecteur.")
Si plusieurs lecteurs sont connectés, précisez l'index :
with CardReader(reader_index=1) as cr:
info = cr.read_informations()
Champs retournés par read_informations()
| Clé | Type | Description |
|---|---|---|
card_number |
str | Numéro de la carte |
validity_start |
datetime | Date début de validité |
validity_end |
datetime | Date fin de validité |
issuing_municipality |
str | Commune de délivrance |
national_number |
str | Numéro national |
last_name |
str | Nom de famille |
first_names |
str | Prénom(s) |
suffix |
str | Suffixe de nom |
nationality |
str | Nationalité |
birth_place |
str | Lieu de naissance |
birth_date |
datetime | Date de naissance |
sex |
str | Sexe |
address |
str | Adresse |
postal_code |
str | Code postal |
city |
str | Localité |
photo |
str | Photo en base64 (si photo=True) |
Activer les logs
import logging
logging.basicConfig(level=logging.DEBUG)
Dépendances
pyscard
Tests
pip install -e ".[dev]"
pytest # tous les tests (matériel skippé si absent)
pytest tests/test_parser.py # tests sans matériel uniquement
Contribuer
Les contributions et améliorations sont les bienvenues !
Licence
Ce projet est sous licence MIT. Voir le fichier LICENSE pour plus de détails.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pythonbeid-0.2.0.tar.gz.
File metadata
- Download URL: pythonbeid-0.2.0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae252a8fc4814515e00c476c2b5b9b1b0ec6426a464119860fee36b9050942c6
|
|
| MD5 |
0007f63f7dea72899c97e93b26abb635
|
|
| BLAKE2b-256 |
9235df34291a5e7b6454bdbde8745efc1b85cba740bfc2ddcb5970472df2d75a
|
File details
Details for the file pythonbeid-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pythonbeid-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77506bc998a0ee6cd3ae28e7e587fc6ece71bcbc4d98adb63fb38fd854db0a9a
|
|
| MD5 |
d7964845a2833c2958097bf94294d8b3
|
|
| BLAKE2b-256 |
c2dbdf18fb1a9fdbbafd2f8daaf4346bc20e6671c9f96c145232fbffa650475c
|