Skip to main content

South African ID number utilities

Project description

rsa-id-number

Utilities for working with South African ID numbers.

RSA ID Number Format

+-------------------------+
|8|8|0|1|2|3|5|1|1|1|0|8|8|
+-------------------------+
|Y|Y|M|M|D|D|S|S|S|S|C|A|Z|
+-------------------------+
  • YYMMDD: The first 6 digits represent the date of birth (23 January 1988)
  • SSSS: The next 4 digits are used to define the individual's gender (Male)
    • Female: 0000 - 4999
    • Male: 5000 - 9999
  • C: The next digit is used to classify citizenship (SA citizen)
    • SA citizen: 0
    • Permanent resident: 1
  • A: The next digit was used until 1980s to classify race
  • Z: The last digit is used as a checksum digit to verify the number (Valid)

Installation

$ pip install rsa-id-number

Usage

>>> import rsaidnumber
>>> id_number = rsaidnumber.parse('8801235111088')
>>> id_number.valid
True
>>> id_number.date_of_birth
datetime.datetime(1988, 1, 23, 0, 0)
>>> id_number.gender
<Gender.MALE: 2>
>>> id_number.citizenship
<Citizenship.SA_CITIZEN: 1>
>>> id_number = rsaidnumber.parse('8801235111080')
Traceback (most recent call last):
  ...
ValueError: '8801235111080' contains an invalid checksum digit!
>>> id_number = rsaidnumber.parse('8801235111080', False)
>>> id_number.valid
False

Contributing

Setup your development environment by running:

$ make

this will create a new Python virtualenv, install all necessary dependencies and run the tests.

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

rsa-id-number-0.0.3.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

rsa_id_number-0.0.3-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file rsa-id-number-0.0.3.tar.gz.

File metadata

  • Download URL: rsa-id-number-0.0.3.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.6

File hashes

Hashes for rsa-id-number-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d24e6474b84351758312bfaa1a76577ae74e1ce1995f8dfd59dd7283013bf29a
MD5 57022a388028035c87946fed289628b3
BLAKE2b-256 387bc2d662ff271db2f02ca22bba93806ca396a4311692d01065377950816e21

See more details on using hashes here.

File details

Details for the file rsa_id_number-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: rsa_id_number-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.6

File hashes

Hashes for rsa_id_number-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5e1a7412d3df1658a198e99ce9269f9004b8bf809a5cd09baa94964f6de7ff94
MD5 81a8546239c175ef63905bae28352664
BLAKE2b-256 1359f9077cba592426c0cc44e4e18b09f8f751e3bf25f9fda9ba7f80cfc370b8

See more details on using hashes here.

Supported by

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