Skip to main content

iso8583

PyPI Documentation Status Test coverage

iso8583 module serializes and deserializes ISO8583 data between a bytes or bytearray instance containing ISO8583 data and a Python dict.

iso8583 supports custom specifications that can define field encoding (e.g. ASCII, EBCDIC, ISO8859-1, BCD, etc.), field types (e.g. fixed, LLVAR, LLLVAR, etc.), and maximum length

Install:

pip install pyiso8583

Decode iso8583 data received from a socket.

>>> import iso8583
>>> from iso8583.specs import default
>>> s = b'0200\x40\x10\x00\x00\x00\x00\x00\x00161234567890123456123456'
>>> doc_dec, doc_enc = iso8583.decode(s, spec=default)

Contents of the produced dictionaries.

>>> import pprint
>>> pprint.pp(doc_dec) # Decoded data
{'bm': {2, 12},
 't': '0200',
 'p': '4010000000000000',
 '2': '1234567890123456',
 '12': '123456'}
>>> pprint.pp(doc_enc) # Encoded data
{'bm': {2, 12},
 't': {'len': b'', 'data': b'0200'},
 'p': {'len': b'', 'data': b'@\x10\x00\x00\x00\x00\x00\x00'},
 '2': {'len': b'16', 'data': b'1234567890123456'},
 '12': {'len': b'', 'data': b'123456'}}

Pretty print result using iso8583.pp.

>>> iso8583.pp(doc_dec, spec=default) # Decoded data only
'bm'  Enabled Fields                      : [2, 12]
't'   Message Type                        : [0200]
'p'   Bitmap, Primary                     : [4010000000000000]
'2'   Primary Account Number (PAN)        : 16 [1234567890123456]
'12'  Time, Local Transaction             : [123456]

Add or remove fields.

>>> iso8583.del_field(doc_dec, '12') # Decoded data only
'123456'
>>> doc_dec['t'] = '0210'
>>> iso8583.add_field(doc_dec, '39', '00')  # Decoded data only

Encode iso8583 data to send to a socket.

>>> s, doc_enc = iso8583.encode(doc_dec, spec=default)
>>> print(s)
bytearray(b'0210@\x00\x00\x00\x02\x00\x00\x0016123456789012345600')

For more info read the docs.

Contribute

iso8583 is hosted on GitHub.

Feel free to fork and send contributions over.

Release files for pyiso8583 1.0.1

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

Source distribution (sdist)

Source distribution for pyiso8583 1.0.1
File Size Uploaded
pyiso8583-1.0.1.tar.gz 12.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyiso8583 1.0.1
File Interpreter ABI Platform
pyiso8583-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 25.7 kB

Release files / pyiso8583-1.0.1.tar.gz

Download URL pyiso8583-1.0.1.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2fdd2edbb796350c11c133099fd88947bca93b11ad3249d7f90a46d276fdeb23
BLAKE2b-256 checksum
How to use checksums
999e342a36e0334f398cb6beb8f92b42f10406a476799699b3e9eaab6371a409
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.8.0

Release files / pyiso8583-1.0.1-py3-none-any.whl

Download URL pyiso8583-1.0.1-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c2c6568a36d183bb3f845f2b4dbabdc93ce9787f2aecddfc7aa94bed8d7a79c
BLAKE2b-256 checksum
How to use checksums
3228ad64c7210c1c1d1fa2d0d8c1e5254bc3f017b88d24138cded8de2b51fa3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.8.0

Release history Release notifications | RSS feed

4.0.1

2 release files

4.0.0

2 release files

3.0.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.2

2 release files

This release

1.0.1 This release

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