pyiso8583


Namepyiso8583 JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://github.com/knovichikhin/pyiso8583
SummaryA serializer and deserializer of ISO8583 data.
upload_time2023-06-05 06:05:56
maintainer
docs_urlNone
authorKonstantin Novichikhin
requires_python>=3.7
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": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "iso8583 8583 banking protocol library",
    "author": "Konstantin Novichikhin",
    "author_email": "konstantin.novichikhin@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f3/42/9ca216b510c6dbd7fb36186df8dd93370f96813141f40c55c5656db1e9c7/pyiso8583-3.0.0.tar.gz",
    "platform": null,
    "description": "iso8583 - a Python package for parsing ISO8583 data\r\n===================================================\r\n\r\n|pypi| |docs| |coverage|\r\n\r\n``iso8583`` package serializes and deserializes ISO8583 data between\r\nraw ``bytes`` ISO8583 data and a regular Python ``dict``.\r\n\r\n``iso8583`` package supports custom `specifications <https://pyiso8583.readthedocs.io/en/latest/specifications.html>`_\r\nthat can define:\r\n\r\n- Field length and data encoding, such as BCD, ASCII, EBCDIC, etc.\r\n- Field length count measured in bytes or nibbles.\r\n- Field type, such as fixed, LLVAR, LLLVAR, etc.\r\n- Maximum length\r\n- Optional field description\r\n\r\nMultiple specifications can co-exist to support ISO8583 messages for POS, ATM,\r\nfile actions, and so on. Simply define a new specification dictionary. ``iso8583``\r\npackage includes a starter specification in ``iso8583.specs`` module that can be\r\nused as a base to create own custom/proprietary specifications.\r\n\r\nAdditional information is available on `Read The Docs <http://pyiso8583.readthedocs.org>`_.\r\n\r\nInstallation\r\n------------\r\n\r\n``iso8583`` is published on `PyPI`__ as ``pyiso8583`` and can be installed from there:\r\n\r\n.. code-block::\r\n\r\n    pip install pyiso8583\r\n\r\n__ https://pypi.org/project/pyiso8583/\r\n\r\nEncoding & Decoding\r\n-------------------\r\n\r\nUse `iso8583.decode <https://pyiso8583.readthedocs.io/en/latest/functions.html#iso8583.decode>`_\r\nto decode raw ISO8583 message.\r\nIt returns two dictionaries: one with decoded data and one with encoded data.\r\n\r\n.. code-block:: python\r\n\r\n    >>> import pprint\r\n    >>> import iso8583\r\n    >>> from iso8583.specs import default_ascii as spec\r\n    >>> encoded_raw = b'02004000000000000000101234567890'\r\n    >>> decoded, encoded = iso8583.decode(encoded_raw, spec)\r\n    >>> pprint.pp(decoded)\r\n    {'t': '0200', 'p': '4000000000000000', '2': '1234567890'}\r\n    >>> pprint.pp(encoded)\r\n    {'t': {'len': b'', 'data': b'0200'},\r\n     'p': {'len': b'', 'data': b'4000000000000000'},\r\n     '2': {'len': b'10', 'data': b'1234567890'}}\r\n\r\nModify the decoded message to send a response back.\r\nChange message type from '0200' to '0210'.\r\nRemove field 2 (PAN). And add field 39 (Response Code).\r\n\r\n.. code-block:: python\r\n\r\n    >>> decoded['t'] = '0210'\r\n    >>> decoded.pop('2', None)\r\n    '1234567890'\r\n    >>> decoded['39'] = '05'\r\n\r\nUse `iso8583.encode <https://pyiso8583.readthedocs.io/en/latest/functions.html#iso8583.encode>`_\r\nto encode updated ISO8583 message.\r\nIt returns a raw ISO8583 message and a dictionary with encoded data.\r\n\r\n.. code-block:: python\r\n\r\n    >>> encoded_raw, encoded = iso8583.encode(decoded, spec)\r\n    >>> encoded_raw\r\n    bytearray(b'0210000000000200000005')\r\n    >>> pprint.pp(decoded)\r\n    {'t': '0210', 'p': '0000000002000000', '39': '05'}\r\n    >>> pprint.pp(encoded)\r\n    {'t': {'len': b'', 'data': b'0210'},\r\n     'p': {'len': b'', 'data': b'0000000002000000'},\r\n     '39': {'len': b'', 'data': b'05'}}\r\n\r\nPretty Print Messages\r\n---------------------\r\n\r\nUse `iso8583.pp <https://pyiso8583.readthedocs.io/en/latest/functions.html#iso8583.pp>`_\r\nto pretty print ISO8583 message.\r\n\r\n.. code-block:: python\r\n\r\n    >>> import iso8583\r\n    >>> from iso8583.specs import default_ascii as spec\r\n    >>> encoded_raw = b'02004000000000000000101234567890'\r\n    >>> decoded, encoded = iso8583.decode(encoded_raw, spec)\r\n    >>> iso8583.pp(decoded, spec)\r\n    t   Message Type                  : '0200'\r\n    p   Bitmap, Primary               : '4000000000000000'\r\n    2   Primary Account Number (PAN)  : '1234567890'\r\n    >>> iso8583.pp(encoded, spec)\r\n    t   Message Type                  : b'0200'\r\n    p   Bitmap, Primary               : b'4000000000000000'\r\n    2   Primary Account Number (PAN)  : b'10' b'1234567890'\r\n\r\nContribute\r\n----------\r\n\r\n``iso8583`` package is hosted on `GitHub <https://github.com/knovichikhin/pyiso8583>`_.\r\n\r\nFeel free to fork and send contributions over.\r\n\r\n.. |pypi| image:: https://img.shields.io/pypi/v/pyiso8583.svg\r\n    :alt: PyPI\r\n    :target:  https://pypi.org/project/pyiso8583/\r\n\r\n.. |docs| image:: https://readthedocs.org/projects/pyiso8583/badge/?version=latest\r\n    :alt: Documentation Status\r\n    :target: https://pyiso8583.readthedocs.io/en/latest/?badge=latest\r\n\r\n.. |coverage| image:: https://codecov.io/gh/knovichikhin/pyiso8583/branch/master/graph/badge.svg\r\n    :alt: Test coverage\r\n    :target: https://codecov.io/gh/knovichikhin/pyiso8583\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A serializer and deserializer of ISO8583 data.",
    "version": "3.0.0",
    "project_urls": {
        "Homepage": "https://github.com/knovichikhin/pyiso8583"
    },
    "split_keywords": [
        "iso8583",
        "8583",
        "banking",
        "protocol",
        "library"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb73d5e4e96202a6fe654a16440ace47700e3170fa3b50f32ad2686c8828c230",
                "md5": "e97f799fe9a28e6884041a18d6e0d94e",
                "sha256": "be3a1f8a855ac4ec6278139aaa07e089e5841ff25747b6d6ba1edc547edc15fc"
            },
            "downloads": -1,
            "filename": "pyiso8583-3.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e97f799fe9a28e6884041a18d6e0d94e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 19587,
            "upload_time": "2023-06-05T06:05:54",
            "upload_time_iso_8601": "2023-06-05T06:05:54.464527Z",
            "url": "https://files.pythonhosted.org/packages/eb/73/d5e4e96202a6fe654a16440ace47700e3170fa3b50f32ad2686c8828c230/pyiso8583-3.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f3429ca216b510c6dbd7fb36186df8dd93370f96813141f40c55c5656db1e9c7",
                "md5": "8e30d4c20cbe2a83bb9c97e08f59856f",
                "sha256": "81419fe09b5ba6c8ba02a7e90a5301da4124106ee9d46f99fa6fbfe1a8439eb3"
            },
            "downloads": -1,
            "filename": "pyiso8583-3.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8e30d4c20cbe2a83bb9c97e08f59856f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 33362,
            "upload_time": "2023-06-05T06:05:56",
            "upload_time_iso_8601": "2023-06-05T06:05:56.323827Z",
            "url": "https://files.pythonhosted.org/packages/f3/42/9ca216b510c6dbd7fb36186df8dd93370f96813141f40c55c5656db1e9c7/pyiso8583-3.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-05 06:05:56",
    "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: 0.08973s