{ "info": { "author": "o3o3o", "author_email": "o3o3o.me@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "[![CircleCI](https://circleci.com/gh/o3o3o/django-graphql-ratelimit.svg?style=svg)](https://circleci.com/gh/o3o3o/django-graphql-ratelimit) ![PyPI](https://img.shields.io/pypi/v/django-graphql-ratelimit)\n\nEaiser to use [django-ratelimit](https://github.com/jsocol/django-ratelimit) for graphql in django.\n\n\n# Install\n\n```\npip install django-graphql-ratelimit\n```\n\n# Usage\n\nratelimit key support `gql:xxx`, where `xxx` is argument.\n\n```python\nfrom django_graphql_ratelimit import ratelimit\nclass RequestSMSCode(graphene.Mutation):\n class Arguments:\n phone = graphene.String(required=True)\n\n ok = graphene.Boolean()\n\n @ratelimit(key=\"ip\", rate=\"10/m\", block=True)\n @ratelimit(key=\"gql:phone\", rate=\"5/m\", block=True)\n def mutate(self, info, phone):\n request = info.context\n # send sms code logic\n return RequestSMSCode(ok=True)\n```\nYou can use [django-ratelimit keys](https://django-ratelimit.readthedocs.io/en/latest/keys.html#common-keys) except `get:xxx` and `post:xxx`:\n* `ip` - Use the request IP address (i.e. `request.META['REMOTE_ADDR']`)\nI suggest you to use [django-ipware](https://github.com/un33k/django-ipware) to get client ip, modify you MIDDLEWARE in settings: \n```\nMIDDLEWARE = [\n\"django_graphql_ratelimit.middleware.ParseClientIpMiddleware\",\n...\n]\n```\n\n* `header:x-x` - Use the value of request.META.get('HTTP_X_X', '').\n* `user`: - Use an appropriate value from request.user. Do not use with unauthenticated users.\n* `user_or_ip` - Use an appropriate value from `request.user` if the user is authenticated, otherwise use request.META['REMOTE_ADDR'] (see the note above about reverse proxies).\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/o3o3o/django-graphql-ratelimit", "keywords": "", "license": "Apache Software License", "maintainer": "", "maintainer_email": "", "name": "django-graphql-ratelimit", "package_url": "https://pypi.org/project/django-graphql-ratelimit/", "platform": "", "project_url": "https://pypi.org/project/django-graphql-ratelimit/", "project_urls": { "Homepage": "https://github.com/o3o3o/django-graphql-ratelimit" }, "release_url": "https://pypi.org/project/django-graphql-ratelimit/1.0.1/", "requires_dist": [ "graphene", "graphene-django", "django-ratelimit", "django-ipware" ], "requires_python": "", "summary": "Use django-ratelimit for graphql", "version": "1.0.1" }, "last_serial": 5833608, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "7c804bd28c70eec2cbea59da36a55d73", "sha256": "459e5d6c7602fae0e274c33952a25b23ee1c86570047589e107cc8eede5cbe28" }, "downloads": -1, "filename": "django_graphql_ratelimit-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "7c804bd28c70eec2cbea59da36a55d73", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6949, "upload_time": "2019-09-14T10:43:40", "url": "https://files.pythonhosted.org/packages/4f/4c/2ae366e638c7647a592438124e8280504ead5986c7fef5b6fb17dbc37ae5/django_graphql_ratelimit-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "30360ad77c716309bc585edf9bebc2a1", "sha256": "ed91b711100381efb249e01d4e43e79e44b001066eb7df79c6bedf51273dca13" }, "downloads": -1, "filename": "django-graphql-ratelimit-0.1.1.tar.gz", "has_sig": false, "md5_digest": "30360ad77c716309bc585edf9bebc2a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5073, "upload_time": "2019-09-14T10:43:43", "url": "https://files.pythonhosted.org/packages/cb/06/4b88d2ac9ab395ccf5f8fcf7848a779b92b99c43974a675769f9e04132a7/django-graphql-ratelimit-0.1.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "9f84f5e596420dd430721b03bd8a259b", "sha256": "e987b9fa1938c61919f2789a8bddc6b73a4b15ff2a60e3ca0c48e152329ab19f" }, "downloads": -1, "filename": "django_graphql_ratelimit-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "9f84f5e596420dd430721b03bd8a259b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6964, "upload_time": "2019-09-14T12:40:05", "url": "https://files.pythonhosted.org/packages/39/a1/7117cd79797ad71f174cd9ad08184f5fe4eec47308fbc327d84070f3ac6a/django_graphql_ratelimit-1.0.0-py3-none-any.whl" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "5dc2f0a6d43138dc1cc5fff1b686bdbe", "sha256": "7bf0c733ffb6ab893e5997b9782f4a4462acb49297526b8599da151684f99d54" }, "downloads": -1, "filename": "django_graphql_ratelimit-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "5dc2f0a6d43138dc1cc5fff1b686bdbe", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7002, "upload_time": "2019-09-16T02:08:33", "url": "https://files.pythonhosted.org/packages/26/13/e6c4c94795db15e7e1cd2c4726cd18b27af714ac55369552d77bad38903e/django_graphql_ratelimit-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5faae9c4a38d46e89b7fb6fb6e45166b", "sha256": "6fb207a81d9e6e792c3e8750d6d1dca5744cb2d16b79cef6cea40a5548dab27f" }, "downloads": -1, "filename": "django-graphql-ratelimit-1.0.1.tar.gz", "has_sig": false, "md5_digest": "5faae9c4a38d46e89b7fb6fb6e45166b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5108, "upload_time": "2019-09-16T02:08:35", "url": "https://files.pythonhosted.org/packages/8d/76/eb2ba040d9d423c709cff502bffb3c7a308c0cbd312413adf209187c9366/django-graphql-ratelimit-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5dc2f0a6d43138dc1cc5fff1b686bdbe", "sha256": "7bf0c733ffb6ab893e5997b9782f4a4462acb49297526b8599da151684f99d54" }, "downloads": -1, "filename": "django_graphql_ratelimit-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "5dc2f0a6d43138dc1cc5fff1b686bdbe", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7002, "upload_time": "2019-09-16T02:08:33", "url": "https://files.pythonhosted.org/packages/26/13/e6c4c94795db15e7e1cd2c4726cd18b27af714ac55369552d77bad38903e/django_graphql_ratelimit-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5faae9c4a38d46e89b7fb6fb6e45166b", "sha256": "6fb207a81d9e6e792c3e8750d6d1dca5744cb2d16b79cef6cea40a5548dab27f" }, "downloads": -1, "filename": "django-graphql-ratelimit-1.0.1.tar.gz", "has_sig": false, "md5_digest": "5faae9c4a38d46e89b7fb6fb6e45166b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5108, "upload_time": "2019-09-16T02:08:35", "url": "https://files.pythonhosted.org/packages/8d/76/eb2ba040d9d423c709cff502bffb3c7a308c0cbd312413adf209187c9366/django-graphql-ratelimit-1.0.1.tar.gz" } ] }