-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e4b000
commit 1cb8b1c
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,46 @@ | ||
# idnumbers | ||
National ID verification libs | ||
|
||
[![PyPI version](https://badge.fury.io/py/idnumbers.svg)](https://badge.fury.io/py/idnumbers) | ||
|
||
This project in early phase. We might change the interface. Please wait our changelogs for more information. | ||
|
||
## Verify National IDs | ||
|
||
All modules under nationalid package support the `validate` function. | ||
|
||
```python | ||
from idnumbers.nationalid import AUS, NGA, ZAF | ||
|
||
# verify AUS tax file number (with checksum code) | ||
AUS.TaxFileNumber.validate('32547689') | ||
|
||
# verify AUS driver license number | ||
AUS.DriverLicenseNumber.validate('12 345 678') | ||
|
||
# verify AUS Medicare number (with checksum code) | ||
AUS.MedicareNumber.validate('2123 45670 1') | ||
|
||
# verify NGA national id number | ||
NGA.NationalID.validate('12345678901') | ||
|
||
# verify ZAF nation id number | ||
ZAF.NationalID.validate('7605300675088') | ||
``` | ||
|
||
## Parse National IDs | ||
|
||
Some modules whose `METADATA.parsable == true` support the `parse` function. It unpacks the detail data from the | ||
national id. | ||
|
||
```python | ||
from idnumbers.nationalid import ZAF | ||
|
||
assert ZAF.NationalID.METADATA.parsable == True | ||
# parse the national id | ||
id_data = ZAF.NationalID.parse('7605300675088') | ||
# access the date of birth, gender, and citizenship | ||
print(id_data['yyyymmdd']) | ||
print(id_data['gender']) | ||
print(id_data['citizenship']) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import os | ||
from setuptools import setup, find_packages | ||
|
||
|
||
# Utility function to read the README file. | ||
# Used for the long_description. It's nice, because now 1) we have a top level | ||
# README file and 2) it's easier to type in the README file than to put a raw | ||
# string in below ... | ||
def read(filename): | ||
with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), filename), 'r') as fin: | ||
return fin.read() | ||
|
||
|
||
setup( | ||
name='idnumbers', | ||
version='0.0.0b1', | ||
author='MicrodataXYZ', | ||
author_email='[email protected]', | ||
description='id numbers verification toolkits', | ||
long_description=read('README.md'), | ||
long_description_content_type='text/markdown', | ||
license='MIT', | ||
url='https://github.com/microdataxyz/idnumbers', | ||
project_urls={ | ||
'Source': 'https://github.com/microdataxyz/idnumbers', | ||
'Tracker': 'https://github.com/microdataxyz/idnumbers/issues', | ||
}, | ||
packages=find_packages(exclude=['test_*']), | ||
python_requires='>=3.7', | ||
install_requires=[], | ||
setup_requires=[], | ||
classifiers=[ | ||
'Development Status :: 2 - Pre-Alpha', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: 3.11', | ||
'Programming Language :: Python :: 3.12', | ||
'Topic :: Software Development :: Libraries :: Python Modules', | ||
'Topic :: Utilities', | ||
'Typing :: Typed' | ||
], ) |