{ "info": { "author": "Julian Pulgarin", "author_email": "julian@pulgarin.co", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": "# django-tokenapi\n\nThis is a Django application which allows you to create simple APIs\nthat use token-based authentication. You can easily open up existing views\nto the API by adding a single decorator.\n\nThis is useful if you want to create applications on mobile devices which\nconnect to your Django website, but where only your clients are expected to\naccess the API.\n\nIf instead you are looking to open up an API to the public, you are better off\ngoing with a framework with OAuth support, of which there exist some really\ngood [implementations](https://bitbucket.org/jespern/django-piston/wiki/Home).\n\n## Requirements\n\n* Django 1.9+\n* Python 2.7+\n\n## Installation\n\nFirst obtain `tokenapi` package and place it somewhere on your `PYTHONPATH`, for example\nin your project directory (where settings.py is).\n\nAlternatively, if you are\nusing some sort of virtual environment, like [virtualenv][], you can perform a\nregular installation or use [pip][]:\n\n python setup.py install\n\n # or ...\n\n pip install django-tokenapi\n\n[virtualenv]: http://pypi.python.org/pypi/virtualenv\n[pip]: http://pip.openplans.org/\n\nAdd `tokenapi` to your `INSTALLED_APPS`.\n\nEnsure that `django.contrib.auth.backends.ModelBackend` is in your `AUTHENTICATION_BACKENDS`.\n\nAdd `tokenapi.backends.TokenBackend` to your `AUTHENTICATION_BACKENDS`.\n\nInclude `tokenapi.urls` in your `urls.py`. It will look something like this:\n\n urlpatterns = [\n url(r'^token/', include('tokenapi.urls')),\n ]\n\n## Configuration\n\nYou can change the number of days that a token is valid for by setting\n`TOKEN_TIMEOUT_DAYS` in `settings.py`. The default is `7`.\n\n## Usage\n\n### Obtaining a Token\n\nYou can obtain a token for a specific user by sending a POST request with a\nusername and password parameter to the `api_token_new` view.\nUsing [curl][], the request would look like:\n\n curl -d \"username=jpulgarin&password=GGGGGG\" http://www.yourdomain.com/token/new.json\n\n[curl]: http://curl.haxx.se/\n\nIf the request is successful, you will receive a JSON response like so:\n\n {\"success\": true, \"token\": \"2uy-420a8efff7f882afc20d\", \"user\": 1}\n\nAn invalid username and password pair will produce a response like so:\n\n {\"success\": false, \"errors\": \"Unable to log you in, please try again\"}\n\nNote that if you User model has an `is_active` flag, the authentication logic will not allow inactive users to obtain or use tokens.\n\nYou should store the `user` and `token` that are returned on the client\naccessing the API, as all subsequent calls will require that the request have\na valid token and user pair.\n\n### Verifying a Token\n\nYou can verify that a token matches a given user by sending a GET request\nto the `api_token` view, and sending the token and user as part of the URL.\nUsing curl it would look like:\n\n curl http://www.yourdomain.com/token/2uy-420a8efff7f882afc20d/1.json\n\nIf valid, you will receive the following JSON response:\n\n {\"success\": true}\n\n### Writing API Compatible Views\n\nTo allow a view to be accessed through token-based auth, use the\n`tokenapi.decorators.token_required` decorator. There are also\nJSON helper functions to make it easier to deal with JSON.\nThis is an example of an API compatible view:\n\n from tokenapi.decorators import token_required\n from tokenapi.http import JsonResponse, JsonError, JsonResponseBadRequest, JsonResponseUnauthorized, JsonResponseForbidden, JsonResponseNotFound, JsonResponseNotAllowed, JsonResponseNotAcceptable\n\n\n @token_required\n def index(request):\n if request.method == 'POST':\n data = {\n 'test1': 49,\n 'test2': 'awesome',\n }\n return JsonResponse(data)\n else:\n return JsonError(\"Only POST is allowed\")\n\n### Using a Token\n\n#### Request Parameters\n\nThe client can access any API compatible view by sending a request to it,\nand including `user` and `token` as request parameters (either GET or POST).\nAccessing the example view above using curl might look like:\n\n curl -d \"user=1&token=2uy-420a8efff7f882afc20d\" http://www.yourdomain.com/new.json\n\nYou would receive the following response:\n\n {\"success\": true, \"test1\": 49, \"test2\": \"awesome\"}\n\n#### Basic authentication\n\nAlternately, you can access any API compatible view by including the user and token in\nthe Authorization header according to the\n[basic access authentication](http://en.wikipedia.org/wiki/Basic_access_authentication)\nscheme. To construct the Authorization header:\n\n1. Combine user id and token into string \"user:token\"\n2. Encode resulting string using Base64\n3. Prepend \"Basic \" (including the trailing space) to the resulting Base64 encoded string\n\nIf, in the same request, you provide credentials via both request parameters and the\nAuthorization header, the request parameters will be used for authentication.\n\n## Acknowledgements\n\nThe token generating code is from `django.contrib.auth.tokens`, but modified so\nthat it does not hash on a user's last login.\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/jpulgarin/django-tokenapi", "keywords": "", "license": "Apache License, Version 2.0", "maintainer": "", "maintainer_email": "", "name": "django-tokenapi", "package_url": "https://pypi.org/project/django-tokenapi/", "platform": "", "project_url": "https://pypi.org/project/django-tokenapi/", "project_urls": { "Homepage": "https://github.com/jpulgarin/django-tokenapi" }, "release_url": "https://pypi.org/project/django-tokenapi/1.2/", "requires_dist": null, "requires_python": "", "summary": "Add an API to your Django app using token-based authentication.", "version": "1.2" }, "last_serial": 5822844, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "e2bac7bce84a05847c8e8660b76196e1", "sha256": "9af8390a3516dbb889ce46d311ed059d4a7761e889fc3edfdd6ae1c4e11e5be7" }, "downloads": -1, "filename": "django-tokenapi-0.1.tar.gz", "has_sig": false, "md5_digest": "e2bac7bce84a05847c8e8660b76196e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4446, "upload_time": "2011-02-25T10:54:44", "url": "https://files.pythonhosted.org/packages/f9/be/640eecc88c189a2d0757962857df88ef4e4e7836c69ef20f2c223ac122ea/django-tokenapi-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "84e2e87f0404dafcea11e443499ac00f", "sha256": "14a43bda2d7e4e1c296e5cecff7fcddc3c8370cbab4519a8651bdb50e7674f1c" }, "downloads": -1, "filename": "django-tokenapi-0.1.1.tar.gz", "has_sig": false, "md5_digest": "84e2e87f0404dafcea11e443499ac00f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4511, "upload_time": "2011-02-26T08:28:55", "url": "https://files.pythonhosted.org/packages/7f/0f/c0a43288af07000de3bb00bc032014cda918f7024eda0887dd1af94737ac/django-tokenapi-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "2fe1184c736a76ae6b883ca04e5dfd32", "sha256": "a770d1e285ff01f044434d18d0882b9a6ea51565f7eda7e5f332c6088869f183" }, "downloads": -1, "filename": "django-tokenapi-0.1.2.tar.gz", "has_sig": false, "md5_digest": "2fe1184c736a76ae6b883ca04e5dfd32", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4514, "upload_time": "2011-03-12T01:38:50", "url": "https://files.pythonhosted.org/packages/1b/d4/737fb74fb91d02974f7c28312698e8a6ee0d0c62b6a6a9068d33b03cfb18/django-tokenapi-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "1d39a1efc508dfd84cb776363c5defdd", "sha256": "6c9414d777415b04be8b98624a4aab352aaf7493074ab837a245fb902f7068e2" }, "downloads": -1, "filename": "django-tokenapi-0.1.3.tar.gz", "has_sig": false, "md5_digest": "1d39a1efc508dfd84cb776363c5defdd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4569, "upload_time": "2011-09-09T13:38:29", "url": "https://files.pythonhosted.org/packages/e8/05/c775a8a5853140c3ad9ce43184c870772e4626244cad15b7941f28998782/django-tokenapi-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "d4dcfb354612544030462879edb7d07a", "sha256": "44e3cc5dcae42decf408fc9d283f76ab59ee790f0983817fc8f4e2fb213ab9dd" }, "downloads": -1, "filename": "django-tokenapi-0.1.4.tar.gz", "has_sig": false, "md5_digest": "d4dcfb354612544030462879edb7d07a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5135, "upload_time": "2011-11-13T03:36:24", "url": "https://files.pythonhosted.org/packages/cd/7e/9d01771ec6992097eb61180d4a9f677f4526ec814f0ae0cfca90a4f20aa2/django-tokenapi-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "044ba3d09095bb4c873f63f43973730a", "sha256": "0ce581095300c0bbaf1755ca02cb0e9023886602dc2459f1c53aec5263756875" }, "downloads": -1, "filename": "django-tokenapi-0.1.5.tar.gz", "has_sig": false, "md5_digest": "044ba3d09095bb4c873f63f43973730a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5702, "upload_time": "2012-05-31T20:04:41", "url": "https://files.pythonhosted.org/packages/4f/16/7416f9918e47adb7a69d032c9cb7b5dd64d8baf67fc48aa4c8fe3c74cbf3/django-tokenapi-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "e9b98e6f318557321ab5506ec15fb733", "sha256": "fe9c0ce66b11018afaf5e49369280f121ed07d18a77ea1f23729f34751093d76" }, "downloads": -1, "filename": "django-tokenapi-0.1.6.tar.gz", "has_sig": false, "md5_digest": "e9b98e6f318557321ab5506ec15fb733", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5684, "upload_time": "2012-07-30T20:26:50", "url": "https://files.pythonhosted.org/packages/26/9b/748698b5946ed6be9934ef2d2a5bd20b26b9db264020279bbd4aa545f96c/django-tokenapi-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "692e9af6981be5f7c63b9ee2677015a0", "sha256": "8bb95a6800b661c8ab7af1069b21c1a4f26cd2c8c1f9eb128734cb2d05797bbd" }, "downloads": -1, "filename": "django-tokenapi-0.1.7.tar.gz", "has_sig": false, "md5_digest": "692e9af6981be5f7c63b9ee2677015a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6124, "upload_time": "2013-05-18T22:18:00", "url": "https://files.pythonhosted.org/packages/9a/a9/594f8b61f1f70a2a06084b53bae8fb89f982d50d1084d073fbb19055bfe4/django-tokenapi-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "55323304b1ddd810bd513715cb3899ec", "sha256": "bc453c16534f94ae7086e7629a116692731be583e7d8adc3b3bd436ec5c4f4cb" }, "downloads": -1, "filename": "django-tokenapi-0.1.8.tar.gz", "has_sig": false, "md5_digest": "55323304b1ddd810bd513715cb3899ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6131, "upload_time": "2013-12-05T08:01:33", "url": "https://files.pythonhosted.org/packages/44/86/f14f8a499404e5f9a979fcba77fbd1505cd92575d81f8772780f417c300d/django-tokenapi-0.1.8.tar.gz" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "4276c1790cc1be34cf3a675deb3576c9", "sha256": "6d2cbc0229cfc77592a0430a1c35fe753e8f058c7ba2cf5a47f891f9e593740d" }, "downloads": -1, "filename": "django-tokenapi-0.1.9.tar.gz", "has_sig": false, "md5_digest": "4276c1790cc1be34cf3a675deb3576c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6136, "upload_time": "2014-02-05T10:26:42", "url": "https://files.pythonhosted.org/packages/87/95/3d5cb354f8de63a3d719206c7e9afbfa15ed5519b13f7628ac10f8b34706/django-tokenapi-0.1.9.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "82b8167ba4dfb75bc460809a2e02d46f", "sha256": "67ea912c4eed1199c14e89dd98aa2ede0255d488bbbc269abe7afbf678d4f62b" }, "downloads": -1, "filename": "django-tokenapi-0.2.0.tar.gz", "has_sig": false, "md5_digest": "82b8167ba4dfb75bc460809a2e02d46f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6274, "upload_time": "2014-02-05T10:53:55", "url": "https://files.pythonhosted.org/packages/d8/01/fe22c0cc0f1cbd250682e9e489e99227d003913c61a16835c80b1ff7bb39/django-tokenapi-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "b7727b0dc855e47c8b943450c36fc27f", "sha256": "9e684ad3b219465a8bb9c40a6608448344fb828a02bed8854af43260a93b4093" }, "downloads": -1, "filename": "django-tokenapi-0.2.1.tar.gz", "has_sig": false, "md5_digest": "b7727b0dc855e47c8b943450c36fc27f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6580, "upload_time": "2014-08-12T03:10:27", "url": "https://files.pythonhosted.org/packages/80/b3/36d6bf501c5b2afc0f006ce2ef10a1565d7e7ff340531463f1e954ddcefd/django-tokenapi-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "40cf061af265b897a6c683163124b3b9", "sha256": "69b74d168b2d60ca4dfbdf243b92c18442cf1e51e93fd5eed24b137602bbc116" }, "downloads": -1, "filename": "django-tokenapi-0.2.2.tar.gz", "has_sig": false, "md5_digest": "40cf061af265b897a6c683163124b3b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6417, "upload_time": "2014-08-12T16:14:30", "url": "https://files.pythonhosted.org/packages/bc/26/1c7807df0cd85d1b79e809382a2e0b80b4c838264a7ed25eac47a0dd9e1b/django-tokenapi-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "f58b9e9650f2933ce1d144e0ed40bf6e", "sha256": "2f6fa5880947d3f68768ebf2aef848a769565ea87f76b9f478fb83cdcb02f2e7" }, "downloads": -1, "filename": "django-tokenapi-0.2.3.tar.gz", "has_sig": false, "md5_digest": "f58b9e9650f2933ce1d144e0ed40bf6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6398, "upload_time": "2015-05-05T08:03:34", "url": "https://files.pythonhosted.org/packages/1d/c8/a8d8c2dcf7e77b571df1b264147333617cb4dd6f606ebee36178acb795d7/django-tokenapi-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "ecce9990e345c3b32c7a8b27a1dbedc8", "sha256": "9316cd04c96c6695b0a0d44001d935a54ceae101a0f4f55fe24a36317988a6f5" }, "downloads": -1, "filename": "django-tokenapi-0.2.4.tar.gz", "has_sig": false, "md5_digest": "ecce9990e345c3b32c7a8b27a1dbedc8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6408, "upload_time": "2016-02-02T06:14:29", "url": "https://files.pythonhosted.org/packages/8a/f4/3ec6348154fddec5d4bb08a2be9a90372db3b43d53ad9f4b7d0415a1eb8a/django-tokenapi-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "dd8e7fa1c8baf96708dd20fd89062ff1", "sha256": "0823830fb88fe02888da3e471cec3c31310924d23f6092fa91b7b06d7d9b9339" }, "downloads": -1, "filename": "django-tokenapi-0.2.5.tar.gz", "has_sig": false, "md5_digest": "dd8e7fa1c8baf96708dd20fd89062ff1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6407, "upload_time": "2016-02-12T16:04:47", "url": "https://files.pythonhosted.org/packages/86/db/5cf913231418b2259f2ecc72f8c09053ce986955bb51fc60c1bd165ed87a/django-tokenapi-0.2.5.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "625214a17c3aca40abb3d9a6c14b0b75", "sha256": "8140e0a40baed1c79aa1fc6ebcbef5d32aeba2488695a575f0433b77b0e09862" }, "downloads": -1, "filename": "django-tokenapi-1.0.tar.gz", "has_sig": false, "md5_digest": "625214a17c3aca40abb3d9a6c14b0b75", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6394, "upload_time": "2017-05-20T02:34:54", "url": "https://files.pythonhosted.org/packages/c9/d8/379a048d2145455edfe097b5c294f1f213ef01732f24460a982027924a7d/django-tokenapi-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "725f3f2288fd530ddc0db51797d7fc8f", "sha256": "0effd4dc37feac988ddef39363d929cc921aa32f75b421020de55b3b8b37a115" }, "downloads": -1, "filename": "django-tokenapi-1.1.tar.gz", "has_sig": false, "md5_digest": "725f3f2288fd530ddc0db51797d7fc8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6442, "upload_time": "2019-04-05T05:15:59", "url": "https://files.pythonhosted.org/packages/7f/80/459dc0de3e3b899ba2c62aad6be5ae71277f830d7f734f550a17b49a2fb1/django-tokenapi-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "0531798ee03eba0a860a410e0d5a6c15", "sha256": "2371b50f760acaf0f0c2c732ae274584b5cc0c122de030b8dbd97e7179953270" }, "downloads": -1, "filename": "django_tokenapi-1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "0531798ee03eba0a860a410e0d5a6c15", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 8816, "upload_time": "2019-09-12T22:17:07", "url": "https://files.pythonhosted.org/packages/43/9e/c8039e2f6edccebe57556697f27ce1cfbde933627acdd94b103718984de0/django_tokenapi-1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4cc2ea43ac18e6efb80ec12794b9f59c", "sha256": "2d8d5837803a06aad84ae38856489f08339fb4ec2a822002e6a48d16176c7720" }, "downloads": -1, "filename": "django-tokenapi-1.2.tar.gz", "has_sig": false, "md5_digest": "4cc2ea43ac18e6efb80ec12794b9f59c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6489, "upload_time": "2019-09-12T22:17:08", "url": "https://files.pythonhosted.org/packages/c9/ff/8bceb3cbacbdeb487ae0d6d9d064f66c5f7181316d0d74cc2259a4115e75/django-tokenapi-1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0531798ee03eba0a860a410e0d5a6c15", "sha256": "2371b50f760acaf0f0c2c732ae274584b5cc0c122de030b8dbd97e7179953270" }, "downloads": -1, "filename": "django_tokenapi-1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "0531798ee03eba0a860a410e0d5a6c15", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 8816, "upload_time": "2019-09-12T22:17:07", "url": "https://files.pythonhosted.org/packages/43/9e/c8039e2f6edccebe57556697f27ce1cfbde933627acdd94b103718984de0/django_tokenapi-1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4cc2ea43ac18e6efb80ec12794b9f59c", "sha256": "2d8d5837803a06aad84ae38856489f08339fb4ec2a822002e6a48d16176c7720" }, "downloads": -1, "filename": "django-tokenapi-1.2.tar.gz", "has_sig": false, "md5_digest": "4cc2ea43ac18e6efb80ec12794b9f59c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6489, "upload_time": "2019-09-12T22:17:08", "url": "https://files.pythonhosted.org/packages/c9/ff/8bceb3cbacbdeb487ae0d6d9d064f66c5f7181316d0d74cc2259a4115e75/django-tokenapi-1.2.tar.gz" } ] }