{ "info": { "author": "Hannes Ljungberg", "author_email": "hannes@5monkeys.se", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "django-formapi\n==============\n\nCreate JSON API:s with HMAC authentication and Django form-validation.\n\n.. image:: https://travis-ci.org/5monkeys/django-formapi.png?branch=master\n :target: http://travis-ci.org/5monkeys/django-formapi\n.. image:: https://coveralls.io/repos/5monkeys/django-formapi/badge.png \n :target: https://coveralls.io/r/5monkeys/django-formapi\n.. image:: https://pypip.in/v/django-formapi/badge.png\n :target: https://pypi.python.org/pypi/django-formapi\n.. image:: https://pypip.in/d/django-formapi/badge.png\n :target: https://pypi.python.org/pypi/django-formapi\n.. image:: https://pypip.in/wheel/django-formapi/badge.png\n :target: https://pypi.python.org/pypi/django-formapi\n.. image:: https://pypip.in/egg/django-formapi/badge.png\n :target: https://pypi.python.org/pypi/django-formapi\n.. image:: https://pypip.in/license/django-formapi/badge.png\n :target: https://pypi.python.org/pypi/django-formapi\n.. image:: https://d2weczhvl823v0.cloudfront.net/5monkeys/django-formapi/trend.png\n :target: https://bitdeli.com/free\n\nInstallation\n------------\n\nInstall django-formapi in your python environment\n\n.. code:: sh\n\n $ pip install django-formapi\n\nAdd ``formapi`` to your ``INSTALLED_APPS`` setting.\n\n.. code:: python\n\n INSTALLED_APPS = (\n ...\n 'formapi',\n )\n\nAdd ``formapi.urls`` to your urls.py.\n\n.. code:: python\n\n urlpatterns = patterns('',\n ...\n url(r'^api/', include('formapi.urls')),\n )\n\nUsage\n-----\n\nGo ahead and create a ``calls.py``. \n\n.. code:: python\n\n class DivisionCall(calls.APICall):\n \"\"\"\n Returns the quotient of two integers\n \"\"\"\n dividend = forms.FloatField()\n divisor = forms.FloatField()\n \n def action(self, test):\n dividend = self.cleaned_data.get('dividend')\n divisor = self.cleaned_data.get('divisor')\n return dividend / divisor\n\n API.register(DivisionCall, 'math', 'divide', version='v1.0.0')\n\n\nJust create a class like your regular Django Forms but inheriting from ``APICall``. Define the fields that your API-call\nshould receive. The ``action`` method is called when your fields have been validated and what is returned will be JSON-encoded\nas a response to the API-caller. The ``API.register`` call takes your ``APICall``-class as first argument, the second argument is \nthe ``namespace`` the API-call should reside in, the third argument is the ``name`` of your call and the fourth the ``version``. \nThis will result in an url in the form of ``api/[version]/[namespace]/[call_name]/`` so we would get ``/api/v1.0.0/math/divide/``.\n\nA valid call with the parameters ``{'dividend': 5, 'divisor': 2}`` would result in this response:\n\n.. code:: javascript\n\n {\"errors\": {}, \"data\": 5, \"success\": true}\n\nAn invalid call with the parameters ``{'dividend': \"five\", 'divisor': 2}`` would result in this response:\n\n.. code:: javascript\n\n {\"errors\": {\"dividend\": [\"Enter a number.\"]}, \"data\": false, \"success\": false}\n\n\nAuthentication\n--------------\nBy default ``APICalls`` have HMAC-authentication turned on. Disable it by setting ``signed_requests = False`` on your ``APICall``.\n\nIf not disabled users of the API will have to sign their calls. To do this they need a ``secret`` generate, create a ``APIKey`` through the django\nadmin interface. On save a personal ``secret`` and ``key`` will be generated for the API-user. \n\nTo build a call signature for the ``DivisonCall`` create a querystring of the calls parameters sorted by the keys ``dividend=5&divisor=2``. Create a HMAC using SHA1 hash function.\nExample in python:\n\n.. code:: python\n \n import hmac\n from hashlib import sha1\n hmac_sign = hmac.new(secret, urllib2.quote('dividend=5&divisor=2'), sha1).hexdigest()\n\nA signed request against ``DivisionCall`` would have the parameters ``{'dividend': 5, 'divisor': 2, 'key': generated_key, 'sign': hmac_sign}``\n\nDocumentation\n-------------\nVisit ``/api/discover`` for a brief documentation of the registered API-calls.", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/5monkeys/django-formapi/tarball/0.2.0", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/5monkeys/django-formapi", "keywords": "django,formapi,api,rpc,signed,request,form,validation", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-formapi", "package_url": "https://pypi.org/project/django-formapi/", "platform": "any", "project_url": "https://pypi.org/project/django-formapi/", "project_urls": { "Download": "https://github.com/5monkeys/django-formapi/tarball/0.2.0", "Homepage": "http://github.com/5monkeys/django-formapi" }, "release_url": "https://pypi.org/project/django-formapi/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "Django API creation with signed requests utilizing forms for validation.", "version": "0.2.0" }, "last_serial": 1484427, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "9e400526ec8fad8f96284c3301c0acce", "sha256": "004254bd9a4c7dd6c2b43abbfb22943bbd3eb7cd0df3eb1b3aaa9e464126dcd6" }, "downloads": -1, "filename": "django-formapi-0.0.1.tar.gz", "has_sig": false, "md5_digest": "9e400526ec8fad8f96284c3301c0acce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12301, "upload_time": "2013-02-22T08:57:59", "url": "https://files.pythonhosted.org/packages/c6/76/a9542806bffe360f81b298c3eda705460aa009f2591feb396fbdb7a02292/django-formapi-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "c09f386e65d18ef34b7cf76c5c51707f", "sha256": "7747199282acfa0b11954bb2212ddd22f3215362b7a01191031604845425590e" }, "downloads": -1, "filename": "django-formapi-0.0.2.tar.gz", "has_sig": false, "md5_digest": "c09f386e65d18ef34b7cf76c5c51707f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12490, "upload_time": "2013-02-22T10:54:04", "url": "https://files.pythonhosted.org/packages/fb/34/f3bfac5f42c761d7f773c104968df19c149e4368689848ff19815fe43d85/django-formapi-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "8973a3a58f08340dd12de386d3fe5709", "sha256": "e7fa85bcd38d42cef83ab08f8563730cb653f97b64669ac007edd2c879537d83" }, "downloads": -1, "filename": "django-formapi-0.0.3.tar.gz", "has_sig": false, "md5_digest": "8973a3a58f08340dd12de386d3fe5709", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 95965, "upload_time": "2013-02-25T21:14:12", "url": "https://files.pythonhosted.org/packages/82/7b/c2a35d2fd607c34746fb3ac85833545833fe2f1039bf8a352fbcc39843db/django-formapi-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "c0c0a9239ec406f050bcdcc26a5b3826", "sha256": "77105dde8a79b23dc63de3865fbb564d91f3bdb0af8a6140fc1aeee099ad595b" }, "downloads": -1, "filename": "django-formapi-0.0.4.tar.gz", "has_sig": false, "md5_digest": "c0c0a9239ec406f050bcdcc26a5b3826", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 96028, "upload_time": "2013-03-01T13:06:37", "url": "https://files.pythonhosted.org/packages/5b/61/0224812fd1d9912225a03b59e71adcc6068c68e0e910536f63b0aaf9f5e5/django-formapi-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "621599c9c75a742e697c5269bc51122f", "sha256": "ff5142371f56182c47ccd81553c37367da57a66f552e8f36ecb8c906a59b86c6" }, "downloads": -1, "filename": "django-formapi-0.0.5.tar.gz", "has_sig": false, "md5_digest": "621599c9c75a742e697c5269bc51122f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 96143, "upload_time": "2013-04-21T13:51:19", "url": "https://files.pythonhosted.org/packages/e4/ec/a86c5928343c9fef0570395da2840236575acd1c02f69e5154a3f6bffd5c/django-formapi-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "7b1f0a54754a3f31813895cd6856cf32", "sha256": "5d3a8576161f946a7cc6010958b531b555482c1c8958b6cda95de05a0d2a6e4c" }, "downloads": -1, "filename": "django-formapi-0.0.6.tar.gz", "has_sig": false, "md5_digest": "7b1f0a54754a3f31813895cd6856cf32", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 96195, "upload_time": "2013-06-25T07:59:32", "url": "https://files.pythonhosted.org/packages/a6/d4/723a6c85fc62d755b271071762548144e0666025477f60bb51c982f7e96a/django-formapi-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "ee08310559b20a362276aeab40ddc3ae", "sha256": "a380e3d5ee4f809cb032e27e72002c88bcc9466fa192bb9dee94a69a01690b48" }, "downloads": -1, "filename": "django-formapi-0.0.7.tar.gz", "has_sig": false, "md5_digest": "ee08310559b20a362276aeab40ddc3ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 96207, "upload_time": "2013-06-25T09:26:20", "url": "https://files.pythonhosted.org/packages/bd/49/f63d76b938425256826cf512a502802ecdfd85ec950fb71a4d2ce1e04413/django-formapi-0.0.7.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "254d7df029b2c47c5c14baf643c6e08e", "sha256": "699ec5903089315fe04297d58558c837bf03bf4958eef7eaddb3625b0957e0e1" }, "downloads": -1, "filename": "django-formapi-0.1.0.tar.gz", "has_sig": false, "md5_digest": "254d7df029b2c47c5c14baf643c6e08e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 93264, "upload_time": "2014-01-31T15:23:36", "url": "https://files.pythonhosted.org/packages/7c/61/61855a762a33ac358471a8bd0a19e59c2c460fef89d953223291265d693b/django-formapi-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "fe825b3550445d1b06949f206328800b", "sha256": "951cb6df2c25f9e875afce40aeda0f476412ed9b2599d508b04fd5e15ec5549e" }, "downloads": -1, "filename": "django-formapi-0.2.0.tar.gz", "has_sig": false, "md5_digest": "fe825b3550445d1b06949f206328800b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 93558, "upload_time": "2015-03-31T07:52:50", "url": "https://files.pythonhosted.org/packages/0d/5d/f29c1c428e8c503444ad7a8bcb01d4dd06ed9b9b3b9eba89bd0ae993ec28/django-formapi-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fe825b3550445d1b06949f206328800b", "sha256": "951cb6df2c25f9e875afce40aeda0f476412ed9b2599d508b04fd5e15ec5549e" }, "downloads": -1, "filename": "django-formapi-0.2.0.tar.gz", "has_sig": false, "md5_digest": "fe825b3550445d1b06949f206328800b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 93558, "upload_time": "2015-03-31T07:52:50", "url": "https://files.pythonhosted.org/packages/0d/5d/f29c1c428e8c503444ad7a8bcb01d4dd06ed9b9b3b9eba89bd0ae993ec28/django-formapi-0.2.0.tar.gz" } ] }