Skip to main content

ticket_decoder

Optional arguments for instance creation of DecoderFacade.

  • uic_public_key_xml_file = "cert/UIC_PublicKeys.xml"
    Relative path to the XML file containing UIC public keys you can obtain here: https://railpublickey.uic.org/ .
  • vdv_certificate_ldif_file = "cert/VDV_Certificates.ldif"
    Relative path to the LDIF file containing VDV certificates to decrypt VDV barcode content.
  • fail_on_decoder_error = false
    Fail when the aztec/barcode decoder gets an error if true or deliver an empty result when false.
  • fail_on_interpreter_error = false
    Fail when the interpretation of the data gets an error if true or deliver an empty result when false.

Provided python API is in an early state and the class DecoderFacade supports 3 methods right now only.

  • decode_bytes('...')

  • decode_base64('...') is considered for the use case you decode the raw data from aztec-code in advance via zxing-cpp or other aztec-code-decoding library of your choice and you want to decode raw train ticket barcode data to json only. In this case, be careful with the output of the decoder to avoid string encodings like UTF8 or other multi-byte encodings. Ideally try to get access to the raw byte array and just encode those bytes to base64 before passing it to the method. If your aztec-code-decoder provides a string-type only and you are able to pass a character-encoding option, try using 'ISO 8859-1' and cast the result string to raw bytes.

  • decode_files('...') detects and decodes aztec-codes from file or directories (PDF, image) and decodes barcode data to json. This is using zxing-cpp and opencv internally. It returns a dict (origin/input-path and json-string) of size x, while x is the amount of aztec-codes found on input. An image can contain always multiple barcodes, the return value is alway a mapping of origin to json content.

    • rotation_degree - Rotate image before processing for the given amount of degrees (default 0)
    • scale_percent - Scale image before processing in percent (default 100)
    • splitting_mode - Split image, 1st number specifies the no of parts to split, 2nd is the part used for processing, clockwise from top/left (default 11)
    • flipping_mode - Flip image around X if 1, around Y if 2, and around X and Y if 3 (default 0)

Example decoding directly from PDF or image

from ticket_decoder import DecoderFacade

decoder_facade = DecoderFacade()
print(decoder_facade.decode_files('path/2/your/ticket.pdf'))

Example decoding Aztec-Code in advance using zxingcpp and opencv on Python side

from ticket_decoder import DecoderFacade
from zxingcpp import read_barcodes
from cv2 import imread

image = imread('path/2/your/ticket.jpg')
if image is None:
    print("Image not found")
    exit(1)

barcodes = read_barcodes(image)
if barcodes is None:
    print("No barcodes found")
    exit(1)

decoder_facade = DecoderFacade(\
    uic_public_key_xml_file = "cert/UIC_PublicKeys.xml",\
    vdv_certificate_ldif_file = "cert/VDV_Certificates.ldif")

print(decoder_facade.decode_bytes(barcodes[0].bytes))

Metadata

Release files for ticket-decoder 0.20.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ticket-decoder 0.20.2
File Size Uploaded
ticket_decoder-0.20.2.tar.gz 1.7 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for ticket-decoder 0.20.2
File
ticket_decoder-0.20.2-cp314-cp314-manylinux_2_34_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.34+ x86-64 Details
ticket_decoder-0.20.2-cp314-cp314-manylinux_2_34_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.34+ ARM64 Details
ticket_decoder-0.20.2-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
ticket_decoder-0.20.2-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details
ticket_decoder-0.20.2-cp313-cp313-manylinux_2_34_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ ARM64 Details
ticket_decoder-0.20.2-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details

Total release size: 62.3 MB

Release files / ticket_decoder-0.20.2.tar.gz

Download URL ticket_decoder-0.20.2.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
7ae95d3a3fff2de6990b58ac38f63106005a3b0c4e81ffab184f6af62f5abb69
BLAKE2b-256 checksum
How to use checksums
50e3cb3b7759824f876f8ad7a6b5bc14dc9fabbbad3ce91ccbe909de15303ab8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.

Transparency log

Release files / ticket_decoder-0.20.2-cp314-cp314-manylinux_2_34_x86_64.whl

Download URL ticket_decoder-0.20.2-cp314-cp314-manylinux_2_34_x86_64.whl
Size 11.9 MB
Tags CPython 3.14 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
242cb1c28d6639573964f9005e919b07fc7461e57622550a70caf95e0fef99ab
BLAKE2b-256 checksum
How to use checksums
7cce0ddaac2a8b5087eee047ac5c6a7117cc09789460063da37dba62fd7e6418
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.

Transparency log

Release files / ticket_decoder-0.20.2-cp314-cp314-manylinux_2_34_aarch64.whl

Download URL ticket_decoder-0.20.2-cp314-cp314-manylinux_2_34_aarch64.whl
Size 10.6 MB
Tags CPython 3.14 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
e7c9bbe0cfbd53a912e7a1c1a86643f089906247a0eefc3db268ad1c4eb34d53
BLAKE2b-256 checksum
How to use checksums
79643eeb715f8a8dc3346475bb53f1c98ed13c27d0cd8d1993b8457e26697cec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.

Transparency log

Release files / ticket_decoder-0.20.2-cp314-cp314-macosx_11_0_arm64.whl

Download URL ticket_decoder-0.20.2-cp314-cp314-macosx_11_0_arm64.whl
Size 7.8 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f3bdb2baecd2ad7917dca80c3a401bb709b7479d06e4d2f3152da608006c6bee
BLAKE2b-256 checksum
How to use checksums
d157ae7cb42e7e45aac862ec7f3ac042ccedcf4e07b05ce27762965e0a513556
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.

Transparency log

Release files / ticket_decoder-0.20.2-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL ticket_decoder-0.20.2-cp313-cp313-manylinux_2_34_x86_64.whl
Size 11.9 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
09943a4bfc1799b1ce5773402d51b494eda285720a4bd97550560c759e568a35
BLAKE2b-256 checksum
How to use checksums
437058b707ffd171d2130d3b81bafddd3b78b8bfc01f5cda744626e55740b7aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.

Transparency log

Release files / ticket_decoder-0.20.2-cp313-cp313-manylinux_2_34_aarch64.whl

Download URL ticket_decoder-0.20.2-cp313-cp313-manylinux_2_34_aarch64.whl
Size 10.6 MB
Tags CPython 3.13 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
4882eb962c9ebe64c1190b9007c87f45d7928a78a9047e1fd95006bda5f925b4
BLAKE2b-256 checksum
How to use checksums
064de9833bbd33dd1dc75a6174db95fb76909ce8f4774b89a01a2146f043615e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.

Transparency log

Release files / ticket_decoder-0.20.2-cp313-cp313-macosx_11_0_arm64.whl

Download URL ticket_decoder-0.20.2-cp313-cp313-macosx_11_0_arm64.whl
Size 7.8 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
861b74abdd5cf0ac4c0c103477831a4159580b301dff7a145a76a848f1b793ad
BLAKE2b-256 checksum
How to use checksums
2c98f6b15a42d988aec117cd0dfcbbf160cdb33f60eb6048df81e587867be523
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.20.2 This release

7 release files

0.20.1

7 release files

0.20.0

7 release files

0.19

7 release files

0.18

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page