aadhaar-py 🐍
This library helps you extract the embedded information 💾 in Aadhaar Secure QR Code
Inspired from 😇
I would like to thank the authors of pyaadhaar. It wouldn't be possible to move into the right direction without this library.
Demo ✔️
Enough talk, show me how it works! ✨
>>> from aadhaar.secure_qr import extract_data
>>> received_qr_code_data = 12345678
>>> extracted_data = extract_data(received_qr_code_data)
The extract_data function returns an instance of ExtractedSecureQRData which has the definition of:
@dataclass(frozen=True)
class ExtractedSecureQRData:
text_data: ExtractedTextData
image: Image.Image
contact_info: ContactData
Text Data 📝:
>>> extracted_data.text_data
ExtractedTextData(reference_id=ReferenceId(last_four_aadhaar_digits='8908', timestamp=datetime.datetime(2019, 3, 5, 15, 1, 37, 123000)), name='Penumarthi Venkat', date_of_birth=datetime.date(1987, 5, 7), gender=<Gender.MALE: 'Male'>, address=Address(care_of='S/O: Pattabhi Rama Rao', district='East Godavari', landmark='Near Siva Temple', house='4-83', location='Sctor-2', pin_code='533016', post_office='Aratlakatta', state='Andhra Pradesh', street='Main Road', sub_district='Karapa', vtc='Aratlakatta'))
The Embedded Image 🌆:
>>> extracted_data.image
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=60x60 at 0x1029CA460>
The Contact Information 📧:
>>> extracted_data.contact_info
ContactData(email=Email(hex_string=None, fourth_aadhaar_digit='8'), mobile=Mobile(hex_string='1f31f19afc2bacbd8afb84526ae4da184a2727e8c2b1b6b9a81e4dc6b74d692a', fourth_aadhaar_digit='8'))
But hey! 🙄 I want to send this data via a ReSTful API, don't you have something to serialize that ugly instance of ExtractedSecureQRData? 😩
to_dict method to the rescue 💪
>>> extracted_data.to_dict()
{
"text_data": {
"reference_id": {
"last_four_aadhaar_digits": "8908",
"timestamp": "2019-03-05T15:01:37.123000"
},
"name": "Penumarthi Venkat",
"date_of_birth": "1987-05-07",
"gender": "Male",
"address": {
"care_of": "S/O: Pattabhi Rama Rao",
"district": "East Godavari",
"landmark": "Near Siva Temple",
"house": "4-83",
"location": "Sctor-2",
"pin_code": "533016",
"post_office": "Aratlakatta",
"state": "Andhra Pradesh",
"street": "Main Road",
"sub_district": "Karapa",
"vtc": "Aratlakatta"
}
},
"image": "data:image/jpeg;base64,/9j/4AAQSkZblahblah",
"contact_info": {
"email": {
"hex_string": None
},
"mobile": {
"hex_string": "1f31f19afc2bacbd8afb84526ae4da184a2727e8c2b1b6b9a81e4dc6b74d692a"
}
}
}
Run Tests 🧪
python -m unittest discover tests/ --verbose
Metadata
Release files for aadhaar-py 2.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aadhaar-py-2.0.2.tar.gz | 7.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aadhaar_py-2.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.6 kB
Release files / aadhaar-py-2.0.2.tar.gz
| Download URL | aadhaar-py-2.0.2.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b67be0669a31e2f49610573e0a4ff01eb7c9e76ec2b23f02eef5c7f7f05a152
|
|
BLAKE2b-256 checksum How to use checksums |
f416e289775d524af17c02048f5ecf7db2398da7b5d1ad2a9cdb9b86f32713c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.9.10 Linux/5.11.0-1028-azure
|
Release files / aadhaar_py-2.0.2-py3-none-any.whl
| Download URL | aadhaar_py-2.0.2-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d9b37137cd6d36cbcd14ad4db43c24a92a428cfbc09db8ae4a8b00ad7481db4c
|
|
BLAKE2b-256 checksum How to use checksums |
8794c145dc3fed1056b1b77d7d849c7667ee14873709cd0ccb005b1e9f656012
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.9.10 Linux/5.11.0-1028-azure
|