south-africa-driving-license


Namesouth-africa-driving-license JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/yushulx/south-africa-driving-license
SummaryDecode, decrypt and parse South Africa driving license
upload_time2022-12-21 09:32:06
maintainer
docs_urlNone
authoryushulx
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python Decoder for Driving License in South Africa
The Python project is used to decode, decrypt and parse South African driving licenses. The PDF417 decoding part relies on [Dynamsoft Barcode Reader](https://www.dynamsoft.com/barcode-reader/overview/), which requires a [license key](https://www.dynamsoft.com/customer/license/trialLicense?product=dbr). 

![South Africa Driving License Parser](https://camo.githubusercontent.com/fecababb27c452d4cfc669e5f0755c41ffdb7244e24d41f0096be09e65ef92bc/68747470733a2f2f7777772e64796e616d736f66742e636f6d2f636f6465706f6f6c2f696d672f323032322f31322f736f7574682d6166726963612d64726976696e672d6c6963656e73652e706e67)


## Command-line Usage
```bash 
$ sadltool [-t TYPES] [-e ENCRYPTED] [-l LICENSE] source

positional arguments:
  source                A source file containing information of driving license.

options:
  -h, --help            show this help message and exit
  -t TYPES, --types TYPES
                        Specify the source type. 1: PDF417 image 2: Base64 string 3: Raw bytes
  -e ENCRYPTED, --encrypted ENCRYPTED
                        Is the source encrypted? 0: No 1: Yes
  -l LICENSE, --license LICENSE
                        The license key is required for decoding PDF417
```

## Try Project Examples:

```bash
python test.py images/dlbase64.txt -t 2 -e 0
python test.py images/dl.raw -t 3 -e 0  
python test.py images/dl.png -l <Dynamsoft Barcode Reader License Key>
```

## Sample Code

```python
import argparse
from sadl import *
import sys
import os

def sadltool():
    
    parser = argparse.ArgumentParser(description='Decode, decrypt and parse South Africa driving license.')
    parser.add_argument('source', help='A source file containing information of driving license.')
    parser.add_argument('-t', '--types', default=1, type=int, help='Specify the source type. 1: PDF417 image 2: Base64 string 3: Raw bytes')
    parser.add_argument('-e', '--encrypted', default=1, type=int, help='Is the source encrypted? 0: No 1: Yes')
    parser.add_argument('-l', '--license', default='', type=str, help='The license key is required for decoding PDF417')
    
    if len(sys.argv) == 1:
        parser.print_help()
        sys.exit(1)
    
    try:
        args = parser.parse_args()
        source = args.source
        types = args.types
        if args.encrypted == 1:
            encrypted = True
        else:
            encrypted = False
        license = args.license
        
        if not os.path.exists(source):
            print('Source not found')
            exit(-1)
            
        if types == 1:
            dl = parse_file(source, encrypted, license)
            print(dl)
        elif types == 2:
            with open(source, 'r') as f:
                source = f.read()
                dl = parse_base64(source, encrypted)
                print(dl)
        elif types == 3:
            data = Path(source).read_bytes()
            dl = parse_bytes(data, encrypted)
            print(dl)
            
    except Exception as err:
        print(err)
        sys.exit(1)
        
sadltool()
```

## How to Build the Package
- Source distribution:
    
    ```bash
    python setup.py sdist
    ```

- Wheel:
    
    ```bash
    pip wheel . --verbose
    # Or
    python setup.py bdist_wheel
    ```

## References
- [https://github.com/ugommirikwe/sa-license-decoder/blob/master/SPEC.md](https://github.com/ugommirikwe/sa-license-decoder/blob/master/SPEC.md)
- [https://stackoverflow.com/questions/17549231/decode-south-african-za-drivers-license](https://stackoverflow.com/questions/17549231/decode-south-african-za-drivers-license)
- [https://github.com/DanieLeeuwner/Reply.Net.SADL/blob/master/Reply.Net.SADL/Reply.Net.SADL/DriversLicenceService.cs](https://github.com/DanieLeeuwner/Reply.Net.SADL/blob/master/Reply.Net.SADL/Reply.Net.SADL/DriversLicenceService.cs)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yushulx/south-africa-driving-license",
    "name": "south-africa-driving-license",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "yushulx",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/61/b1/8b13c680fe11db44501e504a12eccbb17c20a64ca66eaefc1d14984a3fe9/south-africa-driving-license-0.1.1.tar.gz",
    "platform": null,
    "description": "# Python Decoder for Driving License in South Africa\nThe Python project is used to decode, decrypt and parse South African driving licenses. The PDF417 decoding part relies on [Dynamsoft Barcode Reader](https://www.dynamsoft.com/barcode-reader/overview/), which requires a [license key](https://www.dynamsoft.com/customer/license/trialLicense?product=dbr). \n\n![South Africa Driving License Parser](https://camo.githubusercontent.com/fecababb27c452d4cfc669e5f0755c41ffdb7244e24d41f0096be09e65ef92bc/68747470733a2f2f7777772e64796e616d736f66742e636f6d2f636f6465706f6f6c2f696d672f323032322f31322f736f7574682d6166726963612d64726976696e672d6c6963656e73652e706e67)\n\n\n## Command-line Usage\n```bash \n$ sadltool [-t TYPES] [-e ENCRYPTED] [-l LICENSE] source\n\npositional arguments:\n  source                A source file containing information of driving license.\n\noptions:\n  -h, --help            show this help message and exit\n  -t TYPES, --types TYPES\n                        Specify the source type. 1: PDF417 image 2: Base64 string 3: Raw bytes\n  -e ENCRYPTED, --encrypted ENCRYPTED\n                        Is the source encrypted? 0: No 1: Yes\n  -l LICENSE, --license LICENSE\n                        The license key is required for decoding PDF417\n```\n\n## Try Project Examples:\n\n```bash\npython test.py images/dlbase64.txt -t 2 -e 0\npython test.py images/dl.raw -t 3 -e 0  \npython test.py images/dl.png -l <Dynamsoft Barcode Reader License Key>\n```\n\n## Sample Code\n\n```python\nimport argparse\nfrom sadl import *\nimport sys\nimport os\n\ndef sadltool():\n    \n    parser = argparse.ArgumentParser(description='Decode, decrypt and parse South Africa driving license.')\n    parser.add_argument('source', help='A source file containing information of driving license.')\n    parser.add_argument('-t', '--types', default=1, type=int, help='Specify the source type. 1: PDF417 image 2: Base64 string 3: Raw bytes')\n    parser.add_argument('-e', '--encrypted', default=1, type=int, help='Is the source encrypted? 0: No 1: Yes')\n    parser.add_argument('-l', '--license', default='', type=str, help='The license key is required for decoding PDF417')\n    \n    if len(sys.argv) == 1:\n        parser.print_help()\n        sys.exit(1)\n    \n    try:\n        args = parser.parse_args()\n        source = args.source\n        types = args.types\n        if args.encrypted == 1:\n            encrypted = True\n        else:\n            encrypted = False\n        license = args.license\n        \n        if not os.path.exists(source):\n            print('Source not found')\n            exit(-1)\n            \n        if types == 1:\n            dl = parse_file(source, encrypted, license)\n            print(dl)\n        elif types == 2:\n            with open(source, 'r') as f:\n                source = f.read()\n                dl = parse_base64(source, encrypted)\n                print(dl)\n        elif types == 3:\n            data = Path(source).read_bytes()\n            dl = parse_bytes(data, encrypted)\n            print(dl)\n            \n    except Exception as err:\n        print(err)\n        sys.exit(1)\n        \nsadltool()\n```\n\n## How to Build the Package\n- Source distribution:\n    \n    ```bash\n    python setup.py sdist\n    ```\n\n- Wheel:\n    \n    ```bash\n    pip wheel . --verbose\n    # Or\n    python setup.py bdist_wheel\n    ```\n\n## References\n- [https://github.com/ugommirikwe/sa-license-decoder/blob/master/SPEC.md](https://github.com/ugommirikwe/sa-license-decoder/blob/master/SPEC.md)\n- [https://stackoverflow.com/questions/17549231/decode-south-african-za-drivers-license](https://stackoverflow.com/questions/17549231/decode-south-african-za-drivers-license)\n- [https://github.com/DanieLeeuwner/Reply.Net.SADL/blob/master/Reply.Net.SADL/Reply.Net.SADL/DriversLicenceService.cs](https://github.com/DanieLeeuwner/Reply.Net.SADL/blob/master/Reply.Net.SADL/Reply.Net.SADL/DriversLicenceService.cs)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Decode, decrypt and parse South Africa driving license",
    "version": "0.1.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "e3c84734ca2690d982a9742f8aa179a3",
                "sha256": "625eb683f4322d4173d24404bd6540574c135a132ff945b901b1a3f1d8149ea0"
            },
            "downloads": -1,
            "filename": "south_africa_driving_license-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e3c84734ca2690d982a9742f8aa179a3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8267,
            "upload_time": "2022-12-21T09:32:05",
            "upload_time_iso_8601": "2022-12-21T09:32:05.432332Z",
            "url": "https://files.pythonhosted.org/packages/bb/ae/788bb764045cb0b3c8927ef467aac3c117433973b4b1e611a4d5d7a1b47a/south_africa_driving_license-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "a4a6d1770ddfb3d1ee75f117ba768f74",
                "sha256": "971ea98c941cf48b5e21e3d590105bcc67a7fb57e1474f45021c727c37a6aad2"
            },
            "downloads": -1,
            "filename": "south-africa-driving-license-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a4a6d1770ddfb3d1ee75f117ba768f74",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8052,
            "upload_time": "2022-12-21T09:32:06",
            "upload_time_iso_8601": "2022-12-21T09:32:06.929727Z",
            "url": "https://files.pythonhosted.org/packages/61/b1/8b13c680fe11db44501e504a12eccbb17c20a64ca66eaefc1d14984a3fe9/south-africa-driving-license-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-21 09:32:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "yushulx",
    "github_project": "south-africa-driving-license",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "south-africa-driving-license"
}
        
Elapsed time: 0.03025s