{ "info": { "author": "Michael Merickel", "author_email": "pylons-discuss@googlegroups.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Internet :: WWW/HTTP :: WSGI", "Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware" ], "description": "request-id\n==========\n\n.. image:: https://img.shields.io/pypi/v/request-id.svg\n :target: https://pypi.python.org/pypi/request-id\n\n.. image:: https://img.shields.io/travis/mmerickel/request-id/master.svg\n :target: https://travis-ci.org/mmerickel/request-id\n\nAttach a unique identifier to every request in your WSGI application.\n\n``request-id`` is implemented as a WSGI middleware.\n\nThe package will do 3 things:\n\n1. Generate a unique ``request_id`` identifier which will be stored in the\n WSGI ``environ`` and set as the ``X-Request-ID`` response header.\n\n2. Rename the processing thread with the ``request_id`` such that any log\n messages output by the logger have the ``request_id`` attached.\n\n3. Log the request to the Python stdlib logging library, which can be used\n to generate a simple access log.\n\nInstallation\n------------\n\nYou may install the ``request-id`` package using pip::\n\n $ pip install request-id\n\nConfigure with PasteDeploy\n--------------------------\n\nUpdate your application INI to run in a pipeline with the ``request-id``\nfilter::\n\n [app:myapp]\n use = egg:myapp\n\n [filter:request-id]\n use = egg:request-id\n format = {status} {REQUEST_METHOD:<6} {REQUEST_PATH:<60} {REQUEST_ID}\n\n [pipeline:main]\n pipeline =\n request-id\n myapp\n\n [loggers]\n keys = translogger\n\n [handlers]\n keys = translogger\n\n [formatters]\n keys = minimal\n\n [logger_translogger]\n level = INFO\n handlers = translogger\n qualname = request_id\n propagate = 0\n\n [handler_translogger]\n class = StreamHandler\n args = (sys.stderr,)\n level = NOTSET\n formatter = minimal\n\n [formatter_minimal]\n format = %(message)s\n\nConfigure in code\n-----------------\n\nCreate a ``RequestIdMiddleware`` object and compose it with your WSGI\napplication:\n\n.. code-block:: python\n\n from request_id import RequestIdMiddleware\n from wsgiref.simple_server import make_server\n\n def app(environ, start_response):\n start_response('200 OK', [('Content-Type', 'text/plain')])\n yield 'Hello World\\n'\n\n app = RequestIdMiddleware(\n app,\n format='{status} {REQUEST_METHOD:<6} {REQUEST_PATH:<60} {REQUEST_ID}',\n )\n\n if __name__ == '__main__':\n server = make_server('0.0.0.0', 8080, app)\n server.serve_forever()\n\nAccess the request_id\n---------------------\n\nThe ``request_id`` is stored in the request ``environ`` dictionary and may\nbe accessed from anywhere this is available using\n``request_id.get_request_id(request)`` where ``request`` is an instance of\n``webob.request.Request``.\n\nSettings\n--------\n\n``logger_name``\n The name of the Python stdlib logger to which the log output will be\n delivered. Default: ``request_id``\n\n``logging_level``\n The name of the Python stdlib logging level on which request information\n will be output. Default: ``INFO``\n\n``format``\n A formatting string using `PEP-3101`_ string format syntax. Possible\n options are:\n\n - ``REQUEST_ID``\n - ``REMOTE_ADDR``\n - ``REMOTE_USER``\n - ``REQUEST_METHOD``\n - ``REQUEST_URI``\n - ``REQUEST_PATH``\n - ``HTTP_HOST``\n - ``HTTP_VERSION``\n - ``HTTP_REFERER``\n - ``HTTP_USER_AGENT``\n - ``time``\n - ``duration``\n - ``bytes``\n - ``status``\n\n Default: ``'{REMOTE_ADDR} {HTTP_HOST} {REMOTE_USER} [{time}] \"{REQUEST_METHOD} {REQUEST_URI} {HTTP_VERSION}\" {status} {bytes} {duration} \"{HTTP_REFERER}\" \"{HTTP_USER_AGENT}\" - {REQUEST_ID}``\n\n``source_header``\n If not ``None`` then the ``request_id`` will be pulled from this header\n in the request. This is useful if another system upstream is setting a\n request identifier which you want to use in the WSGI application.\n Default: ``None``\n\n``exclude_prefixes``\n A (space or line separated) list of URL paths to be ignored based on\n ``request.path_info``. Paths should have a leading ``/`` in order to match\n properly. Default: ``None``\n\nAcknowledgements\n----------------\n\nThis code is heavily based on the translogger middleware from `Paste`_.\n\n.. _PEP-3101: https://www.python.org/dev/peps/pep-3101/\n.. _Paste: http://pythonpaste.org/\n\n\n1.0 (2018-11-26)\n================\n\n- Fix a bug in ``exclude_prefixes`` where it only matches the first request\n on Python 3.\n\n0.3.1 (2017-11-26)\n==================\n\n- Fix changelog.\n\n0.3 (2017-11-26)\n================\n\n- Do not crash when the source header is missing. Instead set the request id\n to \"-\".\n\n- Properly format the UTC offset in the ``{time}`` timestamp.\n\n- Add 100% test coverage.\n\n0.2.1 (2016-11-03)\n==================\n\n- Fix ``logging_level`` option on Python 3.\n See https://github.com/mmerickel/request-id/pull/2\n\n0.2 (2016-08-09)\n================\n\n- Catch exceptions and return ``webob.exc.HTTPInternalServerError`` so\n that a ``request_id`` may be attached to the response.\n\n0.1.2 (2016-07-26)\n==================\n\n- Fix a couple bugs with ``exclude_prefixes`` and add some docs for it.\n\n0.1.1 (2016-07-26)\n==================\n\n- Add a new setting ``exclude_prefixes`` which can be used to avoid\n logging certain requests.\n\n0.1.0 (2016-07-26)\n==================\n\n- Initial release.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mmerickel/request_id", "keywords": "wsgi unique identifier tracing correlation", "license": "", "maintainer": "", "maintainer_email": "", "name": "request-id", "package_url": "https://pypi.org/project/request-id/", "platform": "", "project_url": "https://pypi.org/project/request-id/", "project_urls": { "Homepage": "https://github.com/mmerickel/request_id" }, "release_url": "https://pypi.org/project/request-id/1.0/", "requires_dist": [ "WebOb", "pytest ; extra == 'testing'", "pytest-cov ; extra == 'testing'", "WebTest ; extra == 'testing'" ], "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "summary": "Attach a unique identifier to every WSGI request.", "version": "1.0" }, "last_serial": 4530730, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "d757ee415f9f1bdf675db31f3c44f4e8", "sha256": "c1dc0b3abeea935575fac04c92085dba60295f8e3a4163743948ddf5bf54d32d" }, "downloads": -1, "filename": "request_id-0.1.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "d757ee415f9f1bdf675db31f3c44f4e8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6943, "upload_time": "2016-07-26T19:54:24", "url": "https://files.pythonhosted.org/packages/d1/eb/dfeffe5d14550ce085bbd3d2c296dde6e412128ffc9c4953e286303759eb/request_id-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dd92d95e532ce23b9aa4cf1901e65e9d", "sha256": "d435628c242f35631e681d2bd06af60bcaff672dff93263bebc5793bed6e9074" }, "downloads": -1, "filename": "request-id-0.1.0.tar.gz", "has_sig": true, "md5_digest": "dd92d95e532ce23b9aa4cf1901e65e9d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5153, "upload_time": "2016-07-26T19:54:28", "url": "https://files.pythonhosted.org/packages/72/c2/0ae8cc126769113f16e65bb66ed465960d9d93b6c7a4e8551b1280003a52/request-id-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "80b4c3eeaa9a1f5775debb65f594141e", "sha256": "6d96677cc9d64a4ff40ba409f4aaeb5fc33d4a72f9d3a511bcf49d703e65aa49" }, "downloads": -1, "filename": "request_id-0.1.1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "80b4c3eeaa9a1f5775debb65f594141e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7544, "upload_time": "2016-07-26T21:34:13", "url": "https://files.pythonhosted.org/packages/f2/3f/43ff872427e95adc4b790b7cf583cbe90bee02a01dfd6e5168504a3860e8/request_id-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5f412f03d3704b28c65435d121919b62", "sha256": "0a419e57173f6bd5bddc962cbc8c48e6977f5fbfa4a0d0538bd6b5cffaedb575" }, "downloads": -1, "filename": "request-id-0.1.1.tar.gz", "has_sig": true, "md5_digest": "5f412f03d3704b28c65435d121919b62", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5554, "upload_time": "2016-07-26T21:34:17", "url": "https://files.pythonhosted.org/packages/b3/4d/94232d914ca0b35b7ce96b6f51f77b063f460d9822646553a937451fd1c8/request-id-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "1208a78900ab3a489e5fb213da2541b3", "sha256": "5bc1635ee64dbab499f82d0a6c341001814ef3462acab874bbeb56ab47ba4368" }, "downloads": -1, "filename": "request_id-0.1.2-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "1208a78900ab3a489e5fb213da2541b3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7809, "upload_time": "2016-07-26T21:38:30", "url": "https://files.pythonhosted.org/packages/2a/98/3a83b2d48806dee8235981c480c2af55860ebd55cba0f519672d9a414041/request_id-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "62698c0a611a1658aeeed79776e9c5db", "sha256": "bfaecb19a18d0c78652086b9907e65cedf4416f44abda7957e6845f9ba5d80b8" }, "downloads": -1, "filename": "request-id-0.1.2.tar.gz", "has_sig": true, "md5_digest": "62698c0a611a1658aeeed79776e9c5db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5717, "upload_time": "2016-07-26T21:38:32", "url": "https://files.pythonhosted.org/packages/bf/b8/aebf777af229dae37f0c598cb8bda155a89974f2b7c66d4012424ed2b7f4/request-id-0.1.2.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "a5185c0e8ff4041d2173dc0001ee540f", "sha256": "0b457dd27634c7983ffdb416be926eb1f26390161697fdd9c9ce4650d7083ee2" }, "downloads": -1, "filename": "request_id-0.2-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "a5185c0e8ff4041d2173dc0001ee540f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8023, "upload_time": "2016-08-09T23:22:02", "url": "https://files.pythonhosted.org/packages/12/4c/94728bdb8bb7234443cd51c2eebb27b12e60edbc38262f329940a0a41436/request_id-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "928280c73ffb393b51c70f949468b34a", "sha256": "6cf902be6d7324a17d7945ff2529a7bc52d6dd0a75e72d956ca8119fc335049e" }, "downloads": -1, "filename": "request-id-0.2.tar.gz", "has_sig": true, "md5_digest": "928280c73ffb393b51c70f949468b34a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5903, "upload_time": "2016-08-09T23:22:06", "url": "https://files.pythonhosted.org/packages/23/59/a03203407502554cc33be3efcaea971d4a53a523501dd4149df02be77bc7/request-id-0.2.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "6209cb04a97e5e340dd41d778dfe0bb6", "sha256": "eac451ac56304000be938aae984dcb9053dda2a81ecdb66cac8a9d2bb261db3b" }, "downloads": -1, "filename": "request_id-0.2.1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "6209cb04a97e5e340dd41d778dfe0bb6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8168, "upload_time": "2016-11-03T19:11:07", "url": "https://files.pythonhosted.org/packages/b6/47/54f9eef98ab3edeb348db7d5966d0dc1dd8b62f03d73d5e57884c34477ad/request_id-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb76c59c773d06e9b551e5dbf6e011a3", "sha256": "6f213ee8333209953f3152f7da2e89858a82040711e40165d6f4177a6e09dae7" }, "downloads": -1, "filename": "request-id-0.2.1.tar.gz", "has_sig": true, "md5_digest": "eb76c59c773d06e9b551e5dbf6e011a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5996, "upload_time": "2016-11-03T19:11:09", "url": "https://files.pythonhosted.org/packages/38/f3/5ea10445cc2adc0da9c9ba4505e44b00e392b571a484145aec2b23367616/request-id-0.2.1.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "10601a0c612ce7d554c3839893fd1e8c", "sha256": "aa198c09efd1d745f73d6187ed0099112e95bd895cafa9ce1103cb93ecb93658" }, "downloads": -1, "filename": "request_id-0.3-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "10601a0c612ce7d554c3839893fd1e8c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 8931, "upload_time": "2017-11-27T05:00:05", "url": "https://files.pythonhosted.org/packages/b0/f1/3f63e00e80f249216e1b99f57b9306520ab236a7c81489c1cd85d75c6322/request_id-0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d8a00c6fc18ee198e3fa965b0999ab68", "sha256": "bc95a6a54f667517b74278876b270670b271fb4aabbf1af171322fa171684841" }, "downloads": -1, "filename": "request-id-0.3.tar.gz", "has_sig": true, "md5_digest": "d8a00c6fc18ee198e3fa965b0999ab68", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 8442, "upload_time": "2017-11-27T05:00:09", "url": "https://files.pythonhosted.org/packages/5e/df/1dd53ba3b84572e8925375c7b3513cad2ff627cd1ae7c1f34cf61b54bba7/request-id-0.3.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "b43214800cd8d65f5cba6996ed38df4e", "sha256": "e99abfc8beb0b72747ce862f0fa12d77c52d51262230641b093b824381cdbfb4" }, "downloads": -1, "filename": "request_id-0.3.1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "b43214800cd8d65f5cba6996ed38df4e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 9187, "upload_time": "2017-11-27T05:07:34", "url": "https://files.pythonhosted.org/packages/19/27/e72dd6170021e3db5100c46672f5bbcf1273f254d1c81e7f588a63713671/request_id-0.3.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "29cdbb13f26c0e944e58cfbebfc52085", "sha256": "4c8adff44ad6779305d5493f780400aff5ff5139e98d622379c0e0797b58d812" }, "downloads": -1, "filename": "request-id-0.3.1.tar.gz", "has_sig": true, "md5_digest": "29cdbb13f26c0e944e58cfbebfc52085", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 8615, "upload_time": "2017-11-27T05:07:37", "url": "https://files.pythonhosted.org/packages/2e/d4/bbe8cdd41012ba54d453452837101cecbb4151866b8aab6ca1ffb00d398c/request-id-0.3.1.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "adca2f0a60e4919f227d502061b80c85", "sha256": "8ce499e211c477057d4fa61658b383d70e47cd1543f408a9b158ae8640c82362" }, "downloads": -1, "filename": "request_id-1.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "adca2f0a60e4919f227d502061b80c85", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 6079, "upload_time": "2018-11-26T18:49:44", "url": "https://files.pythonhosted.org/packages/03/71/a5c344a51356e0123186e9ad338da20410647c8d43f30140c06bb3fb4a9d/request_id-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "81d6159edc745384181cb97f045c51b4", "sha256": "4928002c8e4c767f3f8319194c9f3080ff98f14cabf44c0674a81ee58ec20fc4" }, "downloads": -1, "filename": "request-id-1.0.tar.gz", "has_sig": true, "md5_digest": "81d6159edc745384181cb97f045c51b4", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 8721, "upload_time": "2018-11-26T18:49:46", "url": "https://files.pythonhosted.org/packages/bc/b6/ade909d4af3dffe492789d36ea58a0ecbd637f8200bc480b282d455fe497/request-id-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "adca2f0a60e4919f227d502061b80c85", "sha256": "8ce499e211c477057d4fa61658b383d70e47cd1543f408a9b158ae8640c82362" }, "downloads": -1, "filename": "request_id-1.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "adca2f0a60e4919f227d502061b80c85", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 6079, "upload_time": "2018-11-26T18:49:44", "url": "https://files.pythonhosted.org/packages/03/71/a5c344a51356e0123186e9ad338da20410647c8d43f30140c06bb3fb4a9d/request_id-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "81d6159edc745384181cb97f045c51b4", "sha256": "4928002c8e4c767f3f8319194c9f3080ff98f14cabf44c0674a81ee58ec20fc4" }, "downloads": -1, "filename": "request-id-1.0.tar.gz", "has_sig": true, "md5_digest": "81d6159edc745384181cb97f045c51b4", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 8721, "upload_time": "2018-11-26T18:49:46", "url": "https://files.pythonhosted.org/packages/bc/b6/ade909d4af3dffe492789d36ea58a0ecbd637f8200bc480b282d455fe497/request-id-1.0.tar.gz" } ] }