Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pythonbeid-0.3.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pythonbeid-0.3.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file pythonbeid-0.3.0.tar.gz.

File metadata

  • Download URL: pythonbeid-0.3.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pythonbeid-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ebdbe2127362783acd6035c6f5556f5fa2ebb98ca42d5c67a1acb4155cac414f
MD5 08bf4c076406c654ee3a2d95cbcbb526
BLAKE2b-256 e98768b93d49feeb35060a6db7d409101cc6b1a3f71b8d787aae27074fed9082

See more details on using hashes here.

Provenance

The following attestation bundles were made for pythonbeid-0.3.0.tar.gz:

Publisher: publish-pypi.yml on Lapin-Blanc/pythonbeid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pythonbeid-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pythonbeid-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pythonbeid-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c09354f70042cc58c7bc4662ebcf81ecff9f242f0a39c5bffe9871495652bef8
MD5 3ddae9efdd8d01ed8b8ba81fefe6ed65
BLAKE2b-256 a533de1e91947e152f0f28c3205ce3eddbfb7f98268eaa5fd9d6c139f12ecb64

See more details on using hashes here.

Provenance

The following attestation bundles were made for pythonbeid-0.3.0-py3-none-any.whl:

Publisher: publish-pypi.yml on Lapin-Blanc/pythonbeid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page