{ "info": { "author": "Dotan Nahum", "author_email": "jondotan@gmail.com", "bugtrack_url": null, "classifiers": [ "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" ], "description": "![](media/cover.png)\n\n# Scrub\n\nA Python library for cleaning sensitive data for production and normalizing data for testing.\n\n\n```py\n>>> from scrub import scrub_headers\n>>> sensitive_headers = {\n \"x-api-key\": \"--key--\",\n \"x-date\": \"--filtered--\",\n \"Set-Cookie\": \"--filtered--\",\n }\n>>> scrubber = scrub_headers(sensitive_headers)\n>>> scrubber({\n \"x-api-key\": \"3faf\",\n \"x-date\": \"Oct 18 2001\",\n \"Set-Cookie\": \"secret=3faf00\",\n \"Accept\": \"application/json\",\n })\n{\n 'Accept': 'application/json',\n 'Set-Cookie': '--filtered--',\n 'x-api-key': '--key--',\n 'x-date': '--filtered--'\n}\n>>>\n```\n\n## Quick Start\n\nInstall using pip/pipenv/etc. (we recommend [poetry](https://github.com/sdispater/poetry) for sane dependency management):\n\n```\n$ poetry add --dev scrub\n```\n\nImport a scrubber that you need:\n\n```py\nfrom scrub import scrub_headers scrub_body, scrub_request\n```\n\n### Available Scrubbers\n\n`scrub_headers`\n\nScrubs HTTP headers, or more generally a plain python dict. Initialize with a key replacements dict:\n\n```py\n{\n \"x-api-key\": \"--key--\",\n \"x-date\": \"--filtered--\",\n \"Set-Cookie\": \"--filtered--\",\n}\n```\n\n\n`scrub_body`\n\nScrubs HTTP body, or more generally any piece of text. Initialize with content matching replacement dict:\n\n```py\n{\n \".*\": \"{}\".format(\n base64.b64encode(b\"--filtered--\").decode()\n ),\n \"{.*}\": \"{}\",\n}\n```\n\n`scrub_request`\n\nScrubs a [requests](https://github.com/requests/requests) request. Give it headers and body scrubbers, or identity function if you don't want to replace anything there.\n\n```py\nfrom scrub import scrub_request\nscrubber = scrub_request(headerscrubber, lambda x: x)\n\nscrubber(req)\n```\n\n\n\n### Thanks:\n\nTo all [Contributors](https://github.com/jondot/scrub/graphs/contributors) - you make this happen, thanks!\n\n# Copyright\n\nCopyright (c) 2018 [@jondot](http://twitter.com/jondot). See [LICENSE](LICENSE.txt) for further details.", "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/jondot/scrub", "keywords": "dict,data,nested,functional", "license": "MIT", "maintainer": "Dotan Nahum", "maintainer_email": "jondotan@gmail.com", "name": "scrub", "package_url": "https://pypi.org/project/scrub/", "platform": "", "project_url": "https://pypi.org/project/scrub/", "project_urls": { "Documentation": "https://github.com/jondot/scrub", "Homepage": "https://github.com/jondot/scrub", "Repository": "https://github.com/jondot/scrub" }, "release_url": "https://pypi.org/project/scrub/0.1.2/", "requires_dist": [ "toolz (>=0.9.0,<0.10.0)", "cytoolz (>=0.9.0,<0.10.0)" ], "requires_python": "", "summary": "Scrub sensitive fields for production and data that keeps changing for testing.", "version": "0.1.2" }, "last_serial": 4477650, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "01785f95bc24e3a9c4011262139eb0ab", "sha256": "c7ba8e0bd8c331da7eae4d36446f4eceafaae998f4bc3dc59ece86e9a7e26945" }, "downloads": -1, "filename": "scrub-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "01785f95bc24e3a9c4011262139eb0ab", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3087, "upload_time": "2018-11-12T14:56:14", "url": "https://files.pythonhosted.org/packages/d9/94/0f14f878435766786bc5c987cfe804c9b748c1b1a059963141c4272b029a/scrub-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6c40f0f323be625bcf4273f369f89ca3", "sha256": "22ea8b5400b3db78da78c3c3323c44d68373786322dfb2b12608b2652f993657" }, "downloads": -1, "filename": "scrub-0.1.2.tar.gz", "has_sig": false, "md5_digest": "6c40f0f323be625bcf4273f369f89ca3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2624, "upload_time": "2018-11-12T14:56:15", "url": "https://files.pythonhosted.org/packages/11/4b/b8b531376040f4ebe9b301cb833ab5d7b1781510ff2bc3556941fe057c64/scrub-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "01785f95bc24e3a9c4011262139eb0ab", "sha256": "c7ba8e0bd8c331da7eae4d36446f4eceafaae998f4bc3dc59ece86e9a7e26945" }, "downloads": -1, "filename": "scrub-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "01785f95bc24e3a9c4011262139eb0ab", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3087, "upload_time": "2018-11-12T14:56:14", "url": "https://files.pythonhosted.org/packages/d9/94/0f14f878435766786bc5c987cfe804c9b748c1b1a059963141c4272b029a/scrub-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6c40f0f323be625bcf4273f369f89ca3", "sha256": "22ea8b5400b3db78da78c3c3323c44d68373786322dfb2b12608b2652f993657" }, "downloads": -1, "filename": "scrub-0.1.2.tar.gz", "has_sig": false, "md5_digest": "6c40f0f323be625bcf4273f369f89ca3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2624, "upload_time": "2018-11-12T14:56:15", "url": "https://files.pythonhosted.org/packages/11/4b/b8b531376040f4ebe9b301cb833ab5d7b1781510ff2bc3556941fe057c64/scrub-0.1.2.tar.gz" } ] }