Name | rsa-id-number JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | South African ID number utilities |
upload_time | 2025-09-15 11:51:47 |
maintainer | None |
docs_url | None |
author | Teamgeek |
requires_python | >=3.11 |
license | None |
keywords |
utilities
development
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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
- *Refugee*: 2
- **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
Support for temporary ID numbers issued to refugees can be opted into:
>>> id_number = rsaidnumber.parse('8012215312288', allow_refugee=True)
>>> id_number.valid
True
```
# Contributing
Setup your development environment by running:
```
$ make
```
this will create a new Python *virtualenv*, install all necessary dependencies and run the tests.
Raw data
{
"_id": null,
"home_page": null,
"name": "rsa-id-number",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "utilities, development",
"author": "Teamgeek",
"author_email": "Teamgeek <support@teamgeek.io>",
"download_url": "https://files.pythonhosted.org/packages/a8/ae/e65250eef4ff88fdd296c1bf771bd85573efee11a93c45e696f7516a580b/rsa_id_number-0.1.0.tar.gz",
"platform": null,
"description": "\n# rsa-id-number\n\nUtilities for working with South African ID numbers.\n\n## RSA ID Number Format\n\n```\n+-------------------------+\n|8|8|0|1|2|3|5|1|1|1|0|8|8|\n+-------------------------+\n|Y|Y|M|M|D|D|S|S|S|S|C|A|Z|\n+-------------------------+\n```\n\n- **YYMMDD**: The first 6 digits represent the date of birth (*23 January 1988*)\n- **SSSS**: The next 4 digits are used to define the individual's gender (*Male*)\n - *Female*: 0000 - 4999\n - *Male*: 5000 - 9999\n- **C**: The next digit is used to classify citizenship (*SA citizen*)\n - *SA citizen*: 0\n - *Permanent resident*: 1\n - *Refugee*: 2\n- **A**: The next digit was used until 1980s to classify race\n- **Z**: The last digit is used as a checksum digit to verify the number (*Valid*)\n\n# Installation\n\n```\n$ pip install rsa-id-number\n```\n\n# Usage\n\n```\n>>> import rsaidnumber\n>>> id_number = rsaidnumber.parse('8801235111088')\n>>> id_number.valid\nTrue\n>>> id_number.date_of_birth\ndatetime.datetime(1988, 1, 23, 0, 0)\n>>> id_number.gender\n<Gender.MALE: 2>\n>>> id_number.citizenship\n<Citizenship.SA_CITIZEN: 1>\n>>> id_number = rsaidnumber.parse('8801235111080')\nTraceback (most recent call last):\n ...\nValueError: '8801235111080' contains an invalid checksum digit!\n>>> id_number = rsaidnumber.parse('8801235111080', False)\n>>> id_number.valid\nFalse\n\nSupport for temporary ID numbers issued to refugees can be opted into:\n>>> id_number = rsaidnumber.parse('8012215312288', allow_refugee=True)\n>>> id_number.valid\nTrue\n```\n\n# Contributing\n\nSetup your development environment by running:\n\n```\n$ make\n```\n\nthis will create a new Python *virtualenv*, install all necessary dependencies and run the tests.\n",
"bugtrack_url": null,
"license": null,
"summary": "South African ID number utilities",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/teamgeek-io/rsa-id-number",
"Issues": "https://github.com/teamgeek-io/rsa-id-number/issues"
},
"split_keywords": [
"utilities",
" development"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c5bb37ea2c3ae2df6182c77a7b3ade05e81f9927e6c371fdfe3e36a21b9b3114",
"md5": "99af1b8e4869135ec9111cccb804327d",
"sha256": "16a785e493277daf873621cef6e7ce50df42a930799e85a507ae0647732df0bb"
},
"downloads": -1,
"filename": "rsa_id_number-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "99af1b8e4869135ec9111cccb804327d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 5316,
"upload_time": "2025-09-15T11:51:46",
"upload_time_iso_8601": "2025-09-15T11:51:46.183297Z",
"url": "https://files.pythonhosted.org/packages/c5/bb/37ea2c3ae2df6182c77a7b3ade05e81f9927e6c371fdfe3e36a21b9b3114/rsa_id_number-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a8aee65250eef4ff88fdd296c1bf771bd85573efee11a93c45e696f7516a580b",
"md5": "9327b9fe5b7a6b85ea973af588c8ec7f",
"sha256": "7750e5dbe96b3a8d8a67b83bed740f8fd7fed01c7c5fbe918e0cea349c17f462"
},
"downloads": -1,
"filename": "rsa_id_number-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "9327b9fe5b7a6b85ea973af588c8ec7f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 4069,
"upload_time": "2025-09-15T11:51:47",
"upload_time_iso_8601": "2025-09-15T11:51:47.284637Z",
"url": "https://files.pythonhosted.org/packages/a8/ae/e65250eef4ff88fdd296c1bf771bd85573efee11a93c45e696f7516a580b/rsa_id_number-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-15 11:51:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "teamgeek-io",
"github_project": "rsa-id-number",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "rsa-id-number"
}