{ "info": { "author": "evgeny.zuev", "author_email": "zueves@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": "# Django rest captcha\n\nLightweight version of django-simple-captcha for work with django-rest-framework.\n\n\n## Features\n- speed: used `cache` instead database\n- safety: union methods for generate key and image. (You can't generate many images for one key)\n- easy: only one extended rest api (for generate, refresh image).\n\n\n## Usage\nAdd `RestCaptchaSerializer` to your protected request validator:\n```\nfrom rest_captcha serializer import RestCaptchaSerializer\nclass HumanOnlyDataSerializer(RestCaptchaSerializer):\n pass\n```\nThis code add to your serializer two required fields (captcha_key, captcha_value):\n\n\nFor provide this fields client(js code) should generate key:\n```\n> curl -X POST http:localhost:8000/api/captcha/ | python -m json.tool\n{\n 'image_type': 'image/png',\n 'image_decode': 'base64',\n 'captcha_key': 'de67e7f3-72d9-42d8-9677-ea381610363d',\n 'captcha_value': '... image encoded in base64'\n}\n```\n`captcha_value` - is base64 encoded PNG image, client should decode and show this image to human for validation and send letters from captcha to protected api.\nIf human have mistake - client should re generate your image.\n\n**Note:** See also [trottling](https://www.django-rest-framework.org/api-guide/throttling/) for protect public api\n\n\n## Install\n```\n> pip install django-rest-captcha\n```\n\n### Add to your settings.py\n\nAdd to installed apps:\n```\nINSTALLED_APPS = (\n ...\n 'rest_captcha',\n)\n```\n\nSet rest_captcha settings (if you want), see defaults:\n```\nREST_CAPTCHA = {\n 'CAPTCHA_CACHE': 'default',\n 'CAPTCHA_TIMEOUT': 300, # 5 minutes\n 'CAPTCHA_LENGTH': 4,\n 'CAPTCHA_FONT_SIZE': 22,\n 'CAPTCHA_IMAGE_SIZE': (90, 40),\n 'CAPTCHA_LETTER_ROTATION': (-35, 35),\n 'CAPTCHA_FOREGROUND_COLOR': '#001100',\n 'CAPTCHA_BACKGROUND_COLOR': '#ffffff',\n 'CAPTCHA_FONT_PATH': FONT_PATH,\n 'CAPTCHA_CACHE_KEY': 'rest_captcha_{key}.{version}',\n 'FILTER_FUNCTION': 'rest_captcha.captcha.filter_default',\n 'NOISE_FUNCTION': 'rest_captcha.captcha.noise_default'\n}\n```\n\nWe recommended use redis or memcache. And LocMemCache for local tests with bigger value of MAX_ENTRIES:\n```\nCACHES={\n 'default': {\n 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',\n 'LOCATION': 'rest-captcha',\n 'MAX_ENTRIES': 10000,\n }\n}\n```\n\n### Add hooks to your app router (urls.py)\n```\nurlpatterns = [\n ...\n url(r'api/captcha/', include('rest_captcha.urls')),\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/zueve/django-rest-captcha", "keywords": "", "license": "MIT", "maintainer": "evgeny.zuev", "maintainer_email": "zueves@gmail.com", "name": "django-rest-captcha", "package_url": "https://pypi.org/project/django-rest-captcha/", "platform": "", "project_url": "https://pypi.org/project/django-rest-captcha/", "project_urls": { "Homepage": "https://github.com/zueve/django-rest-captcha", "Repository": "https://github.com/zueve/django-rest-captcha.git" }, "release_url": "https://pypi.org/project/django-rest-captcha/0.1.0/", "requires_dist": [ "djangorestframework (>=3.5,<4.0)", "django", "Pillow (>=4.1.1,<5.0.0)" ], "requires_python": "", "summary": "Lightweight version of django-simple-captcha for work with django-rest-framework", "version": "0.1.0" }, "last_serial": 4502149, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "3077c674ac7d973be03d682cc5dc9bda", "sha256": "a74b54bce5a610a7b75face528a8be468fe73d28c382a471fc91291dfb16b28e" }, "downloads": -1, "filename": "django-rest-captcha-0.0.2.tar.gz", "has_sig": false, "md5_digest": "3077c674ac7d973be03d682cc5dc9bda", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4416, "upload_time": "2017-06-13T07:04:51", "url": "https://files.pythonhosted.org/packages/98/5e/52dfb6314dbafebf0d9d1b53a2fb9e386363359f9bfc16a64cf3e78e549b/django-rest-captcha-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "1e280a25cfcece32bcb546543d086f84", "sha256": "18f5d599a03426170efc76884eaff8000e6282d734f634451712a12c2d8a227f" }, "downloads": -1, "filename": "django-rest-captcha-0.0.3.tar.gz", "has_sig": false, "md5_digest": "1e280a25cfcece32bcb546543d086f84", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 52438, "upload_time": "2017-06-13T08:23:42", "url": "https://files.pythonhosted.org/packages/ae/51/5b259d27b96ee8c23d6fc57a5dd0b22540b99adb97bb74623f4325a872e8/django-rest-captcha-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "9db7fa53cc6cf9d779cdf6683e49656d", "sha256": "b0443d537c9e0b493388acea762927c9bfd916c3c46c17a6b39625128189cbd7" }, "downloads": -1, "filename": "django-rest-captcha-0.0.4.tar.gz", "has_sig": false, "md5_digest": "9db7fa53cc6cf9d779cdf6683e49656d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 52573, "upload_time": "2017-06-13T13:30:24", "url": "https://files.pythonhosted.org/packages/62/ef/a844006dffb1ad41445e17512b9ad36bc4ff950b6cc771be95dcb0ee576e/django-rest-captcha-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "5ea69ef55f57b81d66389d02f260d8b7", "sha256": "d1c16419c175354ba2eb9aa281c6d9c08a8bdd1ae07b73d140b663b992e3e75b" }, "downloads": -1, "filename": "django-rest-captcha-0.0.5.tar.gz", "has_sig": false, "md5_digest": "5ea69ef55f57b81d66389d02f260d8b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 52573, "upload_time": "2017-11-14T08:20:06", "url": "https://files.pythonhosted.org/packages/c0/d4/92c0364094dc2315bab8bfe4752dc612ada2baebcc1f5d9fc7d9a8d4ca1d/django-rest-captcha-0.0.5.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "47c7fc0d284503b1960f86822d76c0bb", "sha256": "d173f45462bf9a7b01cb269fd92f3c4fa7ffece555fbe763b3e47036115ed245" }, "downloads": -1, "filename": "django_rest_captcha-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "47c7fc0d284503b1960f86822d76c0bb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 92916, "upload_time": "2018-11-19T09:39:59", "url": "https://files.pythonhosted.org/packages/7f/b6/a1de5b1bc438612f8f2405eebc91d3bc25cf61405522cb34c948adf55ed4/django_rest_captcha-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3ecdfab8bc212cb2fea1a48a4b5d3e52", "sha256": "ed89f2e3aae1d16e3065326c808d358d251f3704a7167dde616b862bcd54716a" }, "downloads": -1, "filename": "django-rest-captcha-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3ecdfab8bc212cb2fea1a48a4b5d3e52", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 52159, "upload_time": "2018-11-19T09:39:57", "url": "https://files.pythonhosted.org/packages/5e/0f/267f7e69942d07397dedcf4437ffa0c604f274747650ec6b5ee599984c2c/django-rest-captcha-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "47c7fc0d284503b1960f86822d76c0bb", "sha256": "d173f45462bf9a7b01cb269fd92f3c4fa7ffece555fbe763b3e47036115ed245" }, "downloads": -1, "filename": "django_rest_captcha-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "47c7fc0d284503b1960f86822d76c0bb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 92916, "upload_time": "2018-11-19T09:39:59", "url": "https://files.pythonhosted.org/packages/7f/b6/a1de5b1bc438612f8f2405eebc91d3bc25cf61405522cb34c948adf55ed4/django_rest_captcha-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3ecdfab8bc212cb2fea1a48a4b5d3e52", "sha256": "ed89f2e3aae1d16e3065326c808d358d251f3704a7167dde616b862bcd54716a" }, "downloads": -1, "filename": "django-rest-captcha-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3ecdfab8bc212cb2fea1a48a4b5d3e52", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 52159, "upload_time": "2018-11-19T09:39:57", "url": "https://files.pythonhosted.org/packages/5e/0f/267f7e69942d07397dedcf4437ffa0c604f274747650ec6b5ee599984c2c/django-rest-captcha-0.1.0.tar.gz" } ] }