pyiso8583


Namepyiso8583 JSON
Version 4.0.0 PyPI version JSON
download
home_pagehttps://github.com/knovichikhin/pyiso8583
SummaryA serializer and deserializer of ISO8583 data.
upload_time2025-08-10 07:17:06
maintainerNone
docs_urlNone
authorKonstantin Novichikhin
requires_python>=3.8
licenseMIT
keywords iso8583 8583 banking protocol library
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            iso8583 - a Python package for parsing ISO8583 data
===================================================

|pypi| |docs| |coverage|

``iso8583`` package serializes and deserializes ISO8583 data between
raw ``bytes`` ISO8583 data and a regular Python ``dict``.

``iso8583`` package supports custom `specifications <https://pyiso8583.readthedocs.io/en/latest/specifications.html>`_
that can define:

- Field length and data encoding, such as BCD, ASCII, EBCDIC, etc.
- Field length count measured in bytes or nibbles.
- Field type, such as fixed, LLVAR, LLLVAR, etc.
- Maximum length
- Optional field description

Multiple specifications can co-exist to support ISO8583 messages for POS, ATM,
file actions, and so on. Simply define a new specification dictionary. ``iso8583``
package includes a starter specification in ``iso8583.specs`` module that can be
used as a base to create own custom/proprietary specifications.

Additional information is available on `Read The Docs <http://pyiso8583.readthedocs.org>`_.

Installation
------------

``iso8583`` is published on `PyPI`__ as ``pyiso8583`` and can be installed from there:

.. code-block::

    pip install pyiso8583

__ https://pypi.org/project/pyiso8583/

Encoding & Decoding
-------------------

Use `iso8583.decode <https://pyiso8583.readthedocs.io/en/latest/functions.html#iso8583.decode>`_
to decode raw ISO8583 message.
It returns two dictionaries: one with decoded data and one with encoded data.

.. code-block:: python

    >>> import pprint
    >>> import iso8583
    >>> from iso8583.specs import default_ascii as spec
    >>> encoded_raw = b'02004000000000000000101234567890'
    >>> decoded, encoded = iso8583.decode(encoded_raw, spec)
    >>> pprint.pp(decoded)
    {'t': '0200', 'p': '4000000000000000', '2': '1234567890'}
    >>> pprint.pp(encoded)
    {'t': {'len': b'', 'data': b'0200'},
     'p': {'len': b'', 'data': b'4000000000000000'},
     '2': {'len': b'10', 'data': b'1234567890'}}

Modify the decoded message to send a response back.
Change message type from '0200' to '0210'.
Remove field 2 (PAN). And add field 39 (Response Code).

.. code-block:: python

    >>> decoded['t'] = '0210'
    >>> decoded.pop('2', None)
    '1234567890'
    >>> decoded['39'] = '05'

Use `iso8583.encode <https://pyiso8583.readthedocs.io/en/latest/functions.html#iso8583.encode>`_
to encode updated ISO8583 message.
It returns a raw ISO8583 message and a dictionary with encoded data.

.. code-block:: python

    >>> encoded_raw, encoded = iso8583.encode(decoded, spec)
    >>> encoded_raw
    bytearray(b'0210000000000200000005')
    >>> pprint.pp(decoded)
    {'t': '0210', 'p': '0000000002000000', '39': '05'}
    >>> pprint.pp(encoded)
    {'t': {'len': b'', 'data': b'0210'},
     'p': {'len': b'', 'data': b'0000000002000000'},
     '39': {'len': b'', 'data': b'05'}}

Pretty Print Messages
---------------------

Use `iso8583.pp <https://pyiso8583.readthedocs.io/en/latest/functions.html#iso8583.pp>`_
to pretty print ISO8583 message.

.. code-block:: python

    >>> import iso8583
    >>> from iso8583.specs import default_ascii as spec
    >>> encoded_raw = b'02004000000000000000101234567890'
    >>> decoded, encoded = iso8583.decode(encoded_raw, spec)
    >>> iso8583.pp(decoded, spec)
    t   Message Type                  : '0200'
    p   Bitmap, Primary               : '4000000000000000'
    2   Primary Account Number (PAN)  : '1234567890'
    >>> iso8583.pp(encoded, spec)
    t   Message Type                  : b'0200'
    p   Bitmap, Primary               : b'4000000000000000'
    2   Primary Account Number (PAN)  : b'10' b'1234567890'

Contribute
----------

``iso8583`` package is hosted on `GitHub <https://github.com/knovichikhin/pyiso8583>`_.

Feel free to fork and send contributions over.

.. |pypi| image:: https://img.shields.io/pypi/v/pyiso8583.svg
    :alt: PyPI
    :target:  https://pypi.org/project/pyiso8583/

.. |docs| image:: https://readthedocs.org/projects/pyiso8583/badge/?version=latest
    :alt: Documentation Status
    :target: https://pyiso8583.readthedocs.io/en/latest/?badge=latest

.. |coverage| image:: https://codecov.io/gh/knovichikhin/pyiso8583/branch/master/graph/badge.svg
    :alt: Test coverage
    :target: https://codecov.io/gh/knovichikhin/pyiso8583



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/knovichikhin/pyiso8583",
    "name": "pyiso8583",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "iso8583 8583 banking protocol library",
    "author": "Konstantin Novichikhin",
    "author_email": "konstantin.novichikhin@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/15/88/1bbd019097de67330108c35b4614071c1d2c3a1d71152d51785b8797dfb8/pyiso8583-4.0.0.tar.gz",
    "platform": null,
    "description": "iso8583 - a Python package for parsing ISO8583 data\n===================================================\n\n|pypi| |docs| |coverage|\n\n``iso8583`` package serializes and deserializes ISO8583 data between\nraw ``bytes`` ISO8583 data and a regular Python ``dict``.\n\n``iso8583`` package supports custom `specifications <https://pyiso8583.readthedocs.io/en/latest/specifications.html>`_\nthat can define:\n\n- Field length and data encoding, such as BCD, ASCII, EBCDIC, etc.\n- Field length count measured in bytes or nibbles.\n- Field type, such as fixed, LLVAR, LLLVAR, etc.\n- Maximum length\n- Optional field description\n\nMultiple specifications can co-exist to support ISO8583 messages for POS, ATM,\nfile actions, and so on. Simply define a new specification dictionary. ``iso8583``\npackage includes a starter specification in ``iso8583.specs`` module that can be\nused as a base to create own custom/proprietary specifications.\n\nAdditional information is available on `Read The Docs <http://pyiso8583.readthedocs.org>`_.\n\nInstallation\n------------\n\n``iso8583`` is published on `PyPI`__ as ``pyiso8583`` and can be installed from there:\n\n.. code-block::\n\n    pip install pyiso8583\n\n__ https://pypi.org/project/pyiso8583/\n\nEncoding & Decoding\n-------------------\n\nUse `iso8583.decode <https://pyiso8583.readthedocs.io/en/latest/functions.html#iso8583.decode>`_\nto decode raw ISO8583 message.\nIt returns two dictionaries: one with decoded data and one with encoded data.\n\n.. code-block:: python\n\n    >>> import pprint\n    >>> import iso8583\n    >>> from iso8583.specs import default_ascii as spec\n    >>> encoded_raw = b'02004000000000000000101234567890'\n    >>> decoded, encoded = iso8583.decode(encoded_raw, spec)\n    >>> pprint.pp(decoded)\n    {'t': '0200', 'p': '4000000000000000', '2': '1234567890'}\n    >>> pprint.pp(encoded)\n    {'t': {'len': b'', 'data': b'0200'},\n     'p': {'len': b'', 'data': b'4000000000000000'},\n     '2': {'len': b'10', 'data': b'1234567890'}}\n\nModify the decoded message to send a response back.\nChange message type from '0200' to '0210'.\nRemove field 2 (PAN). And add field 39 (Response Code).\n\n.. code-block:: python\n\n    >>> decoded['t'] = '0210'\n    >>> decoded.pop('2', None)\n    '1234567890'\n    >>> decoded['39'] = '05'\n\nUse `iso8583.encode <https://pyiso8583.readthedocs.io/en/latest/functions.html#iso8583.encode>`_\nto encode updated ISO8583 message.\nIt returns a raw ISO8583 message and a dictionary with encoded data.\n\n.. code-block:: python\n\n    >>> encoded_raw, encoded = iso8583.encode(decoded, spec)\n    >>> encoded_raw\n    bytearray(b'0210000000000200000005')\n    >>> pprint.pp(decoded)\n    {'t': '0210', 'p': '0000000002000000', '39': '05'}\n    >>> pprint.pp(encoded)\n    {'t': {'len': b'', 'data': b'0210'},\n     'p': {'len': b'', 'data': b'0000000002000000'},\n     '39': {'len': b'', 'data': b'05'}}\n\nPretty Print Messages\n---------------------\n\nUse `iso8583.pp <https://pyiso8583.readthedocs.io/en/latest/functions.html#iso8583.pp>`_\nto pretty print ISO8583 message.\n\n.. code-block:: python\n\n    >>> import iso8583\n    >>> from iso8583.specs import default_ascii as spec\n    >>> encoded_raw = b'02004000000000000000101234567890'\n    >>> decoded, encoded = iso8583.decode(encoded_raw, spec)\n    >>> iso8583.pp(decoded, spec)\n    t   Message Type                  : '0200'\n    p   Bitmap, Primary               : '4000000000000000'\n    2   Primary Account Number (PAN)  : '1234567890'\n    >>> iso8583.pp(encoded, spec)\n    t   Message Type                  : b'0200'\n    p   Bitmap, Primary               : b'4000000000000000'\n    2   Primary Account Number (PAN)  : b'10' b'1234567890'\n\nContribute\n----------\n\n``iso8583`` package is hosted on `GitHub <https://github.com/knovichikhin/pyiso8583>`_.\n\nFeel free to fork and send contributions over.\n\n.. |pypi| image:: https://img.shields.io/pypi/v/pyiso8583.svg\n    :alt: PyPI\n    :target:  https://pypi.org/project/pyiso8583/\n\n.. |docs| image:: https://readthedocs.org/projects/pyiso8583/badge/?version=latest\n    :alt: Documentation Status\n    :target: https://pyiso8583.readthedocs.io/en/latest/?badge=latest\n\n.. |coverage| image:: https://codecov.io/gh/knovichikhin/pyiso8583/branch/master/graph/badge.svg\n    :alt: Test coverage\n    :target: https://codecov.io/gh/knovichikhin/pyiso8583\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A serializer and deserializer of ISO8583 data.",
    "version": "4.0.0",
    "project_urls": {
        "Homepage": "https://github.com/knovichikhin/pyiso8583"
    },
    "split_keywords": [
        "iso8583",
        "8583",
        "banking",
        "protocol",
        "library"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "214269f7904b18fc61af8744f8bbdc992f0610b1ebdb407a37f74effa1c0c410",
                "md5": "73250423fe84d14e2bf4b08f9d9f5297",
                "sha256": "cfb3e166c789e132dca36d9bb21e2ca7cc070804f6836d0830b694e6704ddc15"
            },
            "downloads": -1,
            "filename": "pyiso8583-4.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "73250423fe84d14e2bf4b08f9d9f5297",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 19637,
            "upload_time": "2025-08-10T07:17:04",
            "upload_time_iso_8601": "2025-08-10T07:17:04.653637Z",
            "url": "https://files.pythonhosted.org/packages/21/42/69f7904b18fc61af8744f8bbdc992f0610b1ebdb407a37f74effa1c0c410/pyiso8583-4.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "15881bbd019097de67330108c35b4614071c1d2c3a1d71152d51785b8797dfb8",
                "md5": "f22ed258bfdeaa5fe5c0ce84fb4de01e",
                "sha256": "05a4f9cac6fb1ebefda6bb0ba1625794abf746b5ca7da5e15e685adfe240a1f3"
            },
            "downloads": -1,
            "filename": "pyiso8583-4.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f22ed258bfdeaa5fe5c0ce84fb4de01e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 33752,
            "upload_time": "2025-08-10T07:17:06",
            "upload_time_iso_8601": "2025-08-10T07:17:06.815918Z",
            "url": "https://files.pythonhosted.org/packages/15/88/1bbd019097de67330108c35b4614071c1d2c3a1d71152d51785b8797dfb8/pyiso8583-4.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-10 07:17:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "knovichikhin",
    "github_project": "pyiso8583",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pyiso8583"
}
        
Elapsed time: 1.98125s