A Python module to help decode IATA-standard boarding passes with barcodes.
Project description
BCBP
A Python module to help decode IATA-standard boarding passes with barcodes.
Data is usually stored on PDF417, QR Code, Aztec, or Data Matrix barcodes as defined by IATA Resolution 792.
Read more about the standard:
Available under the GNU GPLv3 Licence.
Published under the name "hattr".
Usage
Install BCBP using pip install bcbp
.
You will need the datetime
, re
, and json
modules installed for BCBP to function properly.
The following commands are available in BCBP:
bcbp.decode("[IATA Resolution 792-standard BCBP data string.]")
bcbp.encode("[firstname]", "[lastname]", "[pnr]", "[origin]", "[destination]", "[operator]", "[flight number]", "[date]", "[cabin class]", "[seat number]", "[check-in sequence]", [softerror])
Parameters for the bcbp.encode()
command:
Parameter | Data Type | Values | Description |
---|---|---|---|
Firstname | String | Any value which, when combined with Lastname, does not exceed 19 characters. | The passenger's first name, can include titles "MR","MRS","MSTR", "DR", or "MS" after the name. |
Lastname | String | Any value which, when combined with Firstname, does not exceed 19 characters. | The passenger's last name. |
PNR | String | Any value which does not exceed 7 characters. | The Passenger Name Reference (also referred to as a Booking Reference). |
Origin | String | 3-character IATA airport code. | Search Airport Codes Here (IATA Website) |
Destination | String | 3-character IATA airport code. | Search Airport Codes Here (IATA Website) |
Operator | String | 2-character airline/operator code. | Search Airline Codes Here (IATA Website) |
Flight Number | String | Any value which does not exceed 4 characters. | The flight number, usually preceeded by the operator code but this value must only be the number. |
Date | String | A Python datetime date object with at least a month and a day. | A month and day which can be translated into the julian date. Must be a Python datetime date. |
Cabin Class | String | 1-character value. | A single character symbol that represents the class the seat is located in. |
Seat Number | String | 4-character value. | The passenger's seat, usually a 3-digit row followed by a single character seat identifier. |
Check-In Sequence | String | 4-character value. | A 4-digit number that shows which check-in the passenger had (e.g: 1st passenger to check in: 0001, 25th passenger to check in: 0025). |
Softerror | Boolean | A boolean (True/False) value. | Set to True for the command to return an error message in the output rather than a BCBP code. Set to false for an exception to be raised whenever there is an error. |
Planned Upgrades
Error catching when improper string is passed.bcbp.encode()
function.
Acknowledgements
https://shaun.net/notes/whats-contained-in-a-boarding-pass-barcode/
https://gizmodo.com/hacker-builds-a-qr-code-generator-that-lets-him-into-fa-1784884083
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bcbp-1.0.tar.gz
.
File metadata
- Download URL: bcbp-1.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa2ed53e05d63764105c2947e28f4359a500bea017f40e807fc25d94486f1454 |
|
MD5 | 9ffa5afa737372665a986c315248b278 |
|
BLAKE2b-256 | a98b36ce653289117bbdd8c679058a67d7c51239137f567eb6206b5d2625c76f |
File details
Details for the file bcbp-1.0-py3-none-any.whl
.
File metadata
- Download URL: bcbp-1.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e746057b85df985d29411ab16e77aabe26784415b5270972325e3e0f734a1c35 |
|
MD5 | 847e39b6b370a2676e08f8e2e53cf54d |
|
BLAKE2b-256 | ec29158ee8d5900f0c24631925cbee84389083275baabb1f20cc3753e3872818 |