i8t


Namei8t JSON
Version 0.0.12 PyPI version JSON
download
home_pagehttps://github.com/peterdemin/i8t
SummaryNone
upload_time2024-09-26 03:11:04
maintainerNone
docs_urlNone
authorPeter Demin
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            I8t - Introspect client library
===============================

.. image:: https://img.shields.io/pypi/v/i8t.svg
   :target: https://pypi.org/project/i8t

.. image:: https://img.shields.io/pypi/pyversions/i8t.svg

.. image:: https://github.com/peterdemin/i8t/workflows/tests/badge.svg
   :target: https://github.com/peterdemin/i8t/actions?query=workflow%3A%22tests%22
   :alt: tests

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
   :target: https://github.com/psf/black
   :alt: Code style: Black

``i8t`` instruments Python code to send checkpoints to i8t server.

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

.. code-block:: bash

    pip install i8t

Usage
-----

i8t can be used in a few ways:

1. Instrument all inbound web requests (currently only Flask is supported):

   .. code-block:: python

        import flask
        import requests
        from i8t.instrument.flask_introspect import FlaskIntrospect

        app = flask.Flask(__name__)

        app.route("/test", methods=["POST"])
        def test_route():
            return "Test Response", 200
      
        introspect_client = IntrospectClient(
            session=requests.Session(),
            api_url="https://api.demin.dev/i8t/checkpoints/unique-tenant-id",
            name="app",
        )
        flask_introspect = FlaskIntrospect(introspect_client)
        flask_introspect.register(app)

2. Instrument all outbound HTTP requests (currently only requests is supported):

   .. code-block:: python

        import requests
        from i8t.instrument.requests_introspect import RequestsIntrospect

        introspect_client = IntrospectClient(
            session=requests.Session(),
            api_url="https://api.demin.dev/i8t/checkpoints/unique-tenant-id",
            name="app",
        )
        requests_introspect = RequestsIntrospect(introspect_client)
        requests_introspect.register()

3. Decorate any function to send its inputs and outputs:

   .. code-block:: python

        from i8t.client import IntrospectClient, IntrospectDecorator, introspect

        @introspect
        def test_func(first, second):
            return first + second

        introspect_client = IntrospectClient(
            session=requests.Session(),
            api_url="https://api.demin.dev/i8t/checkpoints/unique-tenant-id",
            name="app",
        )
        decorator = IntrospectDecorator(introspect_client)
        decorator.register()

Once initialized, the inputs and outputs of the instrumented calls are sent to the i8t server,
where they can be later fetched at the same URL.

The fetched call checkpoints can be used to set up canned tests.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/peterdemin/i8t",
    "name": "i8t",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Peter Demin",
    "author_email": "peterdemin@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/be/9a/73f7f790f5965ce064c3d6ad7d45031474ccb1ee5514b3e748f54e93f2de/i8t-0.0.12.tar.gz",
    "platform": null,
    "description": "I8t - Introspect client library\n===============================\n\n.. image:: https://img.shields.io/pypi/v/i8t.svg\n   :target: https://pypi.org/project/i8t\n\n.. image:: https://img.shields.io/pypi/pyversions/i8t.svg\n\n.. image:: https://github.com/peterdemin/i8t/workflows/tests/badge.svg\n   :target: https://github.com/peterdemin/i8t/actions?query=workflow%3A%22tests%22\n   :alt: tests\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/psf/black\n   :alt: Code style: Black\n\n``i8t`` instruments Python code to send checkpoints to i8t server.\n\nInstallation\n------------\n\n.. code-block:: bash\n\n    pip install i8t\n\nUsage\n-----\n\ni8t can be used in a few ways:\n\n1. Instrument all inbound web requests (currently only Flask is supported):\n\n   .. code-block:: python\n\n        import flask\n        import requests\n        from i8t.instrument.flask_introspect import FlaskIntrospect\n\n        app = flask.Flask(__name__)\n\n        app.route(\"/test\", methods=[\"POST\"])\n        def test_route():\n            return \"Test Response\", 200\n      \n        introspect_client = IntrospectClient(\n            session=requests.Session(),\n            api_url=\"https://api.demin.dev/i8t/checkpoints/unique-tenant-id\",\n            name=\"app\",\n        )\n        flask_introspect = FlaskIntrospect(introspect_client)\n        flask_introspect.register(app)\n\n2. Instrument all outbound HTTP requests (currently only requests is supported):\n\n   .. code-block:: python\n\n        import requests\n        from i8t.instrument.requests_introspect import RequestsIntrospect\n\n        introspect_client = IntrospectClient(\n            session=requests.Session(),\n            api_url=\"https://api.demin.dev/i8t/checkpoints/unique-tenant-id\",\n            name=\"app\",\n        )\n        requests_introspect = RequestsIntrospect(introspect_client)\n        requests_introspect.register()\n\n3. Decorate any function to send its inputs and outputs:\n\n   .. code-block:: python\n\n        from i8t.client import IntrospectClient, IntrospectDecorator, introspect\n\n        @introspect\n        def test_func(first, second):\n            return first + second\n\n        introspect_client = IntrospectClient(\n            session=requests.Session(),\n            api_url=\"https://api.demin.dev/i8t/checkpoints/unique-tenant-id\",\n            name=\"app\",\n        )\n        decorator = IntrospectDecorator(introspect_client)\n        decorator.register()\n\nOnce initialized, the inputs and outputs of the instrumented calls are sent to the i8t server,\nwhere they can be later fetched at the same URL.\n\nThe fetched call checkpoints can be used to set up canned tests.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "0.0.12",
    "project_urls": {
        "Homepage": "https://github.com/peterdemin/i8t"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a6a3f45faa2277c32122d4c84990e37d835f225c90a38707bc932a8bac84b8d0",
                "md5": "19876762cc9bd3f8f48185a6b0d94b86",
                "sha256": "2dad1079c7bf30c1493fffe746c9f398970cb58dc0fcff4958788f4cf8716230"
            },
            "downloads": -1,
            "filename": "i8t-0.0.12-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "19876762cc9bd3f8f48185a6b0d94b86",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.8",
            "size": 20993,
            "upload_time": "2024-09-26T03:11:03",
            "upload_time_iso_8601": "2024-09-26T03:11:03.258427Z",
            "url": "https://files.pythonhosted.org/packages/a6/a3/f45faa2277c32122d4c84990e37d835f225c90a38707bc932a8bac84b8d0/i8t-0.0.12-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "be9a73f7f790f5965ce064c3d6ad7d45031474ccb1ee5514b3e748f54e93f2de",
                "md5": "e3e20f82414b76c060ddcf0e46438d59",
                "sha256": "b0628759f3cba92e18390ad21bdc457c50b315c7b2c2eda72e1a7dc518c7b087"
            },
            "downloads": -1,
            "filename": "i8t-0.0.12.tar.gz",
            "has_sig": false,
            "md5_digest": "e3e20f82414b76c060ddcf0e46438d59",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 20532,
            "upload_time": "2024-09-26T03:11:04",
            "upload_time_iso_8601": "2024-09-26T03:11:04.656017Z",
            "url": "https://files.pythonhosted.org/packages/be/9a/73f7f790f5965ce064c3d6ad7d45031474ccb1ee5514b3e748f54e93f2de/i8t-0.0.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-26 03:11:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "peterdemin",
    "github_project": "i8t",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "i8t"
}
        
Elapsed time: 0.56125s