{ "info": { "author": "Arni Inaba Kjartansson", "author_email": "arni@inaba.is", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "asgi-request-id\n===============\n\n[![PyPI Downloads](https://img.shields.io/pypi/dm/asgi-request-id.svg)](https://pypi.org/project/asgi-request-id/)\n[![PyPI Version](https://img.shields.io/pypi/v/asgi-request-id.svg)](https://pypi.org/project/asgi-request-id/)\n[![License](https://img.shields.io/badge/license-mit-blue.svg)](https://pypi.org/project/asgi-request-id)\n\nThis was developed at [GRID](https://github.com/GRID-is) for use with our\npython backend services and intended to make it easier to log/generate \nrequest IDs.\n\ninstallation\n------------\n```\npip install asgi-request-id\n```\n\nusage\n-----\n```python\nimport logging\nimport uvicorn\n\nfrom starlette.applications import Starlette\nfrom starlette.responses import PlainTextResponse\n\nfrom asgi_request_id import RequestIDMiddleware, get_request_id\n\nlogger = logging.getLogger(__name__)\napp = Starlette()\n\n\n@app.route(\"/\")\ndef homepage(request):\n logger.info(f\"Request ID: {get_request_id()}\")\n return PlainTextResponse(\"hello world\")\n\n\napp.add_middleware(\n RequestIDMiddleware,\n incoming_request_id_header=\"x-amzn-trace-id\",\n prefix=\"myapp-\",\n)\n\nif __name__ == \"__main__\":\n uvicorn.run(app)\n```\nThe package will do the following:\n\nSearch for an incoming request identifier and use it as the request id if found.\nIf it is not found, an unique request id with an optional prefix is generated.\n\nThe request id is stored in a context variable and made available via \n`get_request_id`\n\nFinally, it is set as the `request_id` response header.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/arni-inaba/asgi-request-id", "keywords": "", "license": "MIT", "maintainer": "Arni Inaba Kjartansson", "maintainer_email": "arni@inaba.is", "name": "asgi-request-id", "package_url": "https://pypi.org/project/asgi-request-id/", "platform": "", "project_url": "https://pypi.org/project/asgi-request-id/", "project_urls": { "Homepage": "https://github.com/arni-inaba/asgi-request-id", "Repository": "https://github.com/arni-inaba/asgi-request-id" }, "release_url": "https://pypi.org/project/asgi-request-id/0.1.2/", "requires_dist": null, "requires_python": ">=3.6,<4.0", "summary": "ASGI request id middleware", "version": "0.1.2", "yanked": false, "yanked_reason": null }, "last_serial": 6799766, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "8f5164c237b1b74f3da12701ce801b34", "sha256": "d6ae35d074e008a27b8a44a1686848756f8d5cc710d2098ea3ff89a7de939c56" }, "downloads": -1, "filename": "asgi_request_id-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "8f5164c237b1b74f3da12701ce801b34", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 3072, "upload_time": "2019-10-26T23:30:06", "upload_time_iso_8601": "2019-10-26T23:30:06.331334Z", "url": "https://files.pythonhosted.org/packages/fd/2a/ee103d0ce84f33d43f9e80cb86871b52d13e8c960233593b8e3c37f60a54/asgi_request_id-0.1.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "a44ec76138085d72cb53664168f52986", "sha256": "90ee57163b816fcc5976c0b3a2be300ee9cbd7f88acbf9f6a82f8eb0bcf588f3" }, "downloads": -1, "filename": "asgi-request-id-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a44ec76138085d72cb53664168f52986", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 2450, "upload_time": "2019-10-26T23:30:03", "upload_time_iso_8601": "2019-10-26T23:30:03.893453Z", "url": "https://files.pythonhosted.org/packages/30/4c/f235c148f8f315a679cde59e47c09e4e8def6125d34071f47f1412f546ed/asgi-request-id-0.1.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "25f2b5d84939e9c897cf6078944272b9", "sha256": "fabbd60e7928ec7a5ad386c2a384cd724cd70ad8ccbd6782242fa2a3658db7b1" }, "downloads": -1, "filename": "asgi_request_id-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "25f2b5d84939e9c897cf6078944272b9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 2741, "upload_time": "2020-03-12T14:42:58", "upload_time_iso_8601": "2020-03-12T14:42:58.581996Z", "url": "https://files.pythonhosted.org/packages/7c/04/10fcb71bae08628f679e7431766ce8609f1b059375a091eb62ce78060ee0/asgi_request_id-0.1.2-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "91042e116d970a5f5f3d0e65f9c60992", "sha256": "707acde3e695898575e61d8c1caac89f7525d6df259e1b0977ab6ce950323b84" }, "downloads": -1, "filename": "asgi-request-id-0.1.2.tar.gz", "has_sig": false, "md5_digest": "91042e116d970a5f5f3d0e65f9c60992", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 2508, "upload_time": "2020-03-12T14:42:57", "upload_time_iso_8601": "2020-03-12T14:42:57.221167Z", "url": "https://files.pythonhosted.org/packages/ba/d2/c45131257a9272cb709fe99b3de6c416647b39123866b79f25a5a7948415/asgi-request-id-0.1.2.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "25f2b5d84939e9c897cf6078944272b9", "sha256": "fabbd60e7928ec7a5ad386c2a384cd724cd70ad8ccbd6782242fa2a3658db7b1" }, "downloads": -1, "filename": "asgi_request_id-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "25f2b5d84939e9c897cf6078944272b9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 2741, "upload_time": "2020-03-12T14:42:58", "upload_time_iso_8601": "2020-03-12T14:42:58.581996Z", "url": "https://files.pythonhosted.org/packages/7c/04/10fcb71bae08628f679e7431766ce8609f1b059375a091eb62ce78060ee0/asgi_request_id-0.1.2-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "91042e116d970a5f5f3d0e65f9c60992", "sha256": "707acde3e695898575e61d8c1caac89f7525d6df259e1b0977ab6ce950323b84" }, "downloads": -1, "filename": "asgi-request-id-0.1.2.tar.gz", "has_sig": false, "md5_digest": "91042e116d970a5f5f3d0e65f9c60992", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 2508, "upload_time": "2020-03-12T14:42:57", "upload_time_iso_8601": "2020-03-12T14:42:57.221167Z", "url": "https://files.pythonhosted.org/packages/ba/d2/c45131257a9272cb709fe99b3de6c416647b39123866b79f25a5a7948415/asgi-request-id-0.1.2.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }