{ "info": { "author": "Marc Galofr\u00e9", "author_email": "mgalofre@apsl.net", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Topic :: Software Development" ], "description": "# Django-Hattori\n\n[![pypi](https://img.shields.io/pypi/v/django-hattori.svg)](https://pypi.python.org/pypi/django-hattori/)\n\n\nCommand to anonymize sensitive data. This app helps you anonymize data in a database used for development of a Django project.\n\nThis app is based on [Django-Database-Anonymizer](https://github.com/Blueshoe/Django-Database-Anonymizer), using [Faker](https://github.com/joke2k/faker) to anonymize the values.\n\n## Installation\n\nInstall using pip:\n\n```\npip install django-hattori\n```\n\nThen add ``'hattori'`` to your ``INSTALLED_APPS``.\n\n```\nINSTALLED_APPS = [\n ...\n 'hattori',\n]\n```\n\n### Important\n\n***You should only run the anonymize process in PRE or development environments***. To avoid problems by default anonymization is disabled.\n\nTo enable you must add to settings ```ANONYMIZE_ENABLED=True```\n\n\n## Usage\n\nHow to execute command:\n\n ./manage.py anonymize_db\n\nPossible arguments:\n\n* ```-a, --app```: Define a app you want to anonymize. All anonymizers in this app will be run. Eg. ```anonymize_db -a shop```\n* ```-m, --models```: List of models you want to anonymize. Eg. ```anonymize_db -m Customer,Product```\n* ```-b, --batch-size```: batch size used in the bulk_update of the instances. Depends on the DB machine, default use 500.\n\n\n## Writing anonymizers\n\nIn order to use the management command we need to define _**anonymizers**_.\n\n* Create a module _anonymizers.py_ in the given django-app\n* An _anonymizer_ is a simple class that inherits from ```BaseAnonymizer```\n* Each anonymizer class is going to represent **one** model\n* An anonymizer has the following members:\n * ```model```: (required) The model class for this anonymizer\n * ```attributes```: (required) List of tuples that determine which fields to replace. The first value of the tuple is the fieldname, the second value is the _**replacer**_\n * ```get_query_set()```: (optional) Define your QuerySet\n* A _replacer_ is either of type _str_ or _callable_\n* A callable _replacer_ is a Faker instance or custom replacer.\n* All Faker methods are available. For more info read the official documentation [Faker!](http://faker.readthedocs.io/en/master/providers.html)\n\n\n#### Example\n```\nfrom hattori.base import BaseAnonymizer, faker\nfrom shop.models import Customer\n\nclass CustomerAnonymizer(BaseAnonymizer):\n model = Customer\n\n attributes = [\n ('card_number', faker.credit_card_number),\n ('first_name', faker.first_name),\n ('last_name', faker.last_name),\n ('phone', faker.phone_number),\n ('email', faker.email),\n ('city', faker.city),\n ('comment', faker.text),\n ('description', 'fix string'),\n ('code', faker.pystr),\n ]\n\n def get_query_set(self):\n return Customer.objects.filter(age__gt=18)\n```\n\n#### Extending the existing replacers with arguments\nUse lambdas to extend certain predefined replacers with arguments, like `min_chars` or `max_chars` on `faker.pystr`:\n\n```\n('code', lambda **kwargs: faker.pystr(min_chars=250, max_chars=250, **kwargs)),\n```\n\n**Important**: don't forget the ****kwargs**!\n\n\n", "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/APSL/django-hattori", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "django-hattori", "package_url": "https://pypi.org/project/django-hattori/", "platform": "", "project_url": "https://pypi.org/project/django-hattori/", "project_urls": { "Homepage": "https://github.com/APSL/django-hattori" }, "release_url": "https://pypi.org/project/django-hattori/0.2.1/", "requires_dist": [ "Django (>=1.8)", "django-bulk-update (>=2.2.0)", "Faker (>=0.8.13)", "six", "tqdm (>=4.23.4)" ], "requires_python": "", "summary": "Command to anonymize sensitive data.", "version": "0.2.1" }, "last_serial": 5841245, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "ba54101884d994ec3c8c0c6459d308c5", "sha256": "7de43b9018533fc789f3f2fa0bbe4498f8c1c5e49979c84ef1a45f5138258be3" }, "downloads": -1, "filename": "django_hattori-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ba54101884d994ec3c8c0c6459d308c5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6913, "upload_time": "2018-05-18T08:50:28", "url": "https://files.pythonhosted.org/packages/8d/92/33b036d1bf977da05777d6de0be946383825434d312ef03a24fed297578f/django_hattori-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2d8d57f4d06588d05e1192845514f1b8", "sha256": "e38b4e687c1521d85aff193a044e89bdcbd2af61f1d17692831dc9d4b4362b09" }, "downloads": -1, "filename": "django-hattori-0.1.tar.gz", "has_sig": false, "md5_digest": "2d8d57f4d06588d05e1192845514f1b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6479, "upload_time": "2018-05-18T08:50:30", "url": "https://files.pythonhosted.org/packages/92/37/962f841d4bbf708253477340ab436b7243a296c01f3db123d43029584130/django-hattori-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a0d7106ddd1393f54393b333a1049cd6", "sha256": "3aa6abda893403c150841bcbc4a8ad51ddf43a1ff8433a98a6334da481ada2d7" }, "downloads": -1, "filename": "django_hattori-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a0d7106ddd1393f54393b333a1049cd6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6929, "upload_time": "2018-06-11T11:57:33", "url": "https://files.pythonhosted.org/packages/f1/46/5dbc49d303921121543a65479029ebebcc3e9ab2c9a15c7df87e0434c9e5/django_hattori-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e5deef44cfb7b8017a24af808f230e85", "sha256": "aa64fa24e14281b51f9d4102c85fc629027ba61cfc02afe6795db716895a2533" }, "downloads": -1, "filename": "django-hattori-0.1.1.tar.gz", "has_sig": false, "md5_digest": "e5deef44cfb7b8017a24af808f230e85", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6544, "upload_time": "2018-06-11T11:57:34", "url": "https://files.pythonhosted.org/packages/e5/ce/116a47a3d3995a794abdb014fb13c9b52923293d3a8b5b747182559f2138/django-hattori-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "d990d8fed4a720fcad1e72246327f368", "sha256": "38894d314b6b7f9a83a7bc9273fcca4cab6d997cfd4e046ce4e82682dc7182fb" }, "downloads": -1, "filename": "django_hattori-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d990d8fed4a720fcad1e72246327f368", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7006, "upload_time": "2018-07-30T12:02:13", "url": "https://files.pythonhosted.org/packages/57/76/6aa85f2f98f8b37753bc5d36d744a4fee8fb31c4d7181cd4427e89fee594/django_hattori-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9cf8c03571576e5ff78cc670053a9677", "sha256": "14d7cef81eb4bcf191d5716b19206f7dec905392be85afe7bcc846cf1ed3d7ed" }, "downloads": -1, "filename": "django-hattori-0.1.2.tar.gz", "has_sig": false, "md5_digest": "9cf8c03571576e5ff78cc670053a9677", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6666, "upload_time": "2018-07-30T12:02:15", "url": "https://files.pythonhosted.org/packages/c9/5a/23b7fa8f9e4e8564e83547cd6bd1882d764b444b2444a7be43a6b0be6090/django-hattori-0.1.2.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "4b6e8d0be9aa1fc1e019fc38411d2a81", "sha256": "bfcce6c3f8b4525a3ce56bd5ef123969cb0e09815972fceeef599aad4ba50586" }, "downloads": -1, "filename": "django_hattori-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4b6e8d0be9aa1fc1e019fc38411d2a81", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8038, "upload_time": "2018-10-29T16:41:58", "url": "https://files.pythonhosted.org/packages/a0/52/c641d0dad3ad66b9e3134449accf40748a5c5dde5dead4f37586abfc17a9/django_hattori-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "92f8a2af52bb5687a0a33969210162a4", "sha256": "f81ab17daf6d8a30378549f31513bd6d82af154577eb0b2a86e2b2e0be0a9df4" }, "downloads": -1, "filename": "django-hattori-0.2.0.tar.gz", "has_sig": false, "md5_digest": "92f8a2af52bb5687a0a33969210162a4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6623, "upload_time": "2018-10-29T16:42:00", "url": "https://files.pythonhosted.org/packages/80/d6/86aa9a838afa39a70b76a858ae3fe0e98c1e2560e7e123ed387b6d140d15/django-hattori-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "f8267436dc8b4d829e70d268518c64b2", "sha256": "e529ed7af8fc34a0169c797c477672b687a205a56f3f5206f90c260acb83b7ac" }, "downloads": -1, "filename": "django_hattori-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f8267436dc8b4d829e70d268518c64b2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8080, "upload_time": "2019-09-17T11:34:12", "url": "https://files.pythonhosted.org/packages/f4/83/705362cb906746bddb6213f6cd67930f5329852f58e89403dc5ad3640be3/django_hattori-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "236407160efec38fd53bbc39803be887", "sha256": "6953d40881317252f19f62c4e7fe8058924b852c7498bc42beb7bc4d268c252c" }, "downloads": -1, "filename": "django-hattori-0.2.1.tar.gz", "has_sig": false, "md5_digest": "236407160efec38fd53bbc39803be887", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6696, "upload_time": "2019-09-17T11:34:14", "url": "https://files.pythonhosted.org/packages/27/f9/0087cf8ccbd57082082146c719c1afd9a3745e188bf483c225f275d4d197/django-hattori-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f8267436dc8b4d829e70d268518c64b2", "sha256": "e529ed7af8fc34a0169c797c477672b687a205a56f3f5206f90c260acb83b7ac" }, "downloads": -1, "filename": "django_hattori-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f8267436dc8b4d829e70d268518c64b2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8080, "upload_time": "2019-09-17T11:34:12", "url": "https://files.pythonhosted.org/packages/f4/83/705362cb906746bddb6213f6cd67930f5329852f58e89403dc5ad3640be3/django_hattori-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "236407160efec38fd53bbc39803be887", "sha256": "6953d40881317252f19f62c4e7fe8058924b852c7498bc42beb7bc4d268c252c" }, "downloads": -1, "filename": "django-hattori-0.2.1.tar.gz", "has_sig": false, "md5_digest": "236407160efec38fd53bbc39803be887", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6696, "upload_time": "2019-09-17T11:34:14", "url": "https://files.pythonhosted.org/packages/27/f9/0087cf8ccbd57082082146c719c1afd9a3745e188bf483c225f275d4d197/django-hattori-0.2.1.tar.gz" } ] }