{ "info": { "author": "Alex Kessinger", "author_email": "voidfiles@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "django-simpleapi: API's for everyone\n====================================\n\n.. image:: https://api.travis-ci.org/voidfiles/django-simpleapi.svg\n :target: https://travis-ci.org/voidfiles/django-simpleapi\n\n.. image:: https://badge.fury.io/py/django-simpleapi.png\n :target: http://badge.fury.io/py/django-simpleapi\n\n.. image:: https://pypip.in/d/django-simpleapi/badge.png\n :target: https://crate.io/packages/django-simpleapi/\n\n\ndjango-simpleapi is an MIT Licensed django app, written in Python, for developers.\n\nHow many times have you wanted to create a simple JSON api in Django.\nI mean simple. There are great tools out their like * and * but sometimes\nyou just want to send back some JSON.\n\nThis app makes it super simple to do that.\n\n.. code-block:: python\n\n from simpleapi import api_handler\n\n @api_handler\n def get_some_yak(request):\n return {\n 'yak': 'yummm'\n }\n\n urlpatterns = patterns(\n '',\n url(r'^get/some/yak$', get_some_yak),\n )\n\n.. code-block:: shell\n\n curl http://localhost:8000/get/some/yak\n\n {\n \"data\": {\n \"yak\": \"yummm\"\n },\n \"meta\": {\n \"code\": 200\n }\n }\n\n\n\nFeatures\n--------\n\n- A Simple API for Django\n- Easy execption handling, creation\n- Easy addition to meta\n\nInstallation\n------------\n\nTo install Requests, simply:\n\n.. code-block:: bash\n\n $ pip install django-simpleapi\n\n\nDocumentation\n-------------\n\nThis easyiest way to get started is to use the `api_handler` decorator.\n\n.. code-block:: python\n\n from simpleapi import api_handler\n\n @api_handler\n def get_some_yak(request):\n return {\n 'yak': 'yummm'\n }\n\nAny view function that returns a dict object will work with this interface.\n\nNext, often in APIs you need to fail for some reason. Validation, missing params, you name it. There is an easy way to make that happen `SimpleHttpException`\n\n.. code-block:: python\n\n from simpleapi import api_handler, SimpleHttpException\n\n @api_handler\n def get_some_yak(request):\n required_param = request.GET.get('required_param')\n\n if required_param is None:\n raise SimpleHttpException(\"Missing required_param\", 'missing-required-param', 400)\n\n return {\n 'yak': 'yummm'\n }\n\n\nNow when you request this view and forget to pass required_param you would see something like this.\n\n\n.. code-block:: shell\n\n curl http://localhost:8000/get/some/yak\n\n {\n \"meta\": {\n \"code\": 400,\n \"error_message\": \"Missing required_param\",\n \"error_slug\": \"missing-required-param\"\n }\n }\n\nNot only will the HTTP Status code be in the meta response, it will also be the HTTP Code sent back. Error slug is helpfull in resolving exceptions progrmattically. It's mucher easier then relying on string grepping to figure out what went wrong.\n\nFinally, you might want to add you own information to the meta part of the envelope. This would helpfull for passing information like pagination information.\n\n.. code-block:: python\n\n from simpleapi import api_handler\n\n @api_handler\n def get_some_yak(request):\n request.META['_simple_api_meta']['yak_count'] = 1\n\n return {\n 'yak': 'yummm'\n }\n\nThe response would now look something like this.\n\n.. code-block:: shell\n\n curl http://localhost:8000/get/some/yak\n\n {\n \"data\": {\n \"yak\": \"yummm\"\n },\n \"meta\": {\n \"code\": 200,\n \"yak_counter\": 1\n }\n }", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/voidfiles/django-simpleapi", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-simpleapi", "package_url": "https://pypi.org/project/django-simpleapi/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-simpleapi/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/voidfiles/django-simpleapi" }, "release_url": "https://pypi.org/project/django-simpleapi/1.4.0/", "requires_dist": null, "requires_python": null, "summary": "A Django package that allows you to write APIs simply", "version": "1.4.0" }, "last_serial": 1428602, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "9a44f7e08831de9ac789d43611a622f1", "sha256": "f177159f3b67ba1eba22604c6c0bc5ee1ace6603c44bf32c2a13982222b0451a" }, "downloads": -1, "filename": "django-simpleapi-1.0.tar.gz", "has_sig": false, "md5_digest": "9a44f7e08831de9ac789d43611a622f1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3290, "upload_time": "2014-12-19T07:45:19", "url": "https://files.pythonhosted.org/packages/c0/17/1e5e1c8919c658e9675a3486597964e46523b4365293a5e9562745ffc973/django-simpleapi-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "2aa702e9edc9a083d57a644cabc7c898", "sha256": "5412ac68d2496dda873491293a1a62c535c516923fdf2adbfd3e80f8b26ff0c8" }, "downloads": -1, "filename": "django-simpleapi-1.0.1.tar.gz", "has_sig": false, "md5_digest": "2aa702e9edc9a083d57a644cabc7c898", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3300, "upload_time": "2014-12-23T01:40:44", "url": "https://files.pythonhosted.org/packages/15/11/7c2b411623125eed446147b5d5b4dea5b49c175b6a91d11af902b8b05f9b/django-simpleapi-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "05721e99405c232aacacecd502c06c26", "sha256": "6c94de3c1e1540ad8c2ddf6cb02dd94ce569556abf5fd588ab1cefedd1647626" }, "downloads": -1, "filename": "django-simpleapi-1.0.2.tar.gz", "has_sig": false, "md5_digest": "05721e99405c232aacacecd502c06c26", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3285, "upload_time": "2014-12-23T01:54:21", "url": "https://files.pythonhosted.org/packages/e0/6e/15ea2f471f21e4b6a897ccd87cf23bac19682b992483fe072b1804aad1ec/django-simpleapi-1.0.2.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "85425b7785a5e821d45b9f9ef9e1164a", "sha256": "59e807da924769bce5a58a4ab1d3588d60d96a644afe9cb7e908c4aa0bead826" }, "downloads": -1, "filename": "django-simpleapi-1.1.0.tar.gz", "has_sig": false, "md5_digest": "85425b7785a5e821d45b9f9ef9e1164a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4517, "upload_time": "2015-01-04T08:36:43", "url": "https://files.pythonhosted.org/packages/b4/8a/d02f748cf8ad800d4d2fdea0123701dfc42ac3bf694ab4873ca950e2150d/django-simpleapi-1.1.0.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "90163ecd5d0a9194ab20473b40619c8c", "sha256": "aa839b5f62f70b30314ca8886b95fea07b18776c1927fc5f451fb57dc681e687" }, "downloads": -1, "filename": "django-simpleapi-1.2.1.tar.gz", "has_sig": false, "md5_digest": "90163ecd5d0a9194ab20473b40619c8c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4574, "upload_time": "2015-01-05T20:56:44", "url": "https://files.pythonhosted.org/packages/37/14/81976521a4ca096ddaf69dc09ac0682ef4ef2bc4bf87c3910ed7ffd9c9bd/django-simpleapi-1.2.1.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "df38aee4a9e46d854f3fd6936ec67e21", "sha256": "5ecde87d6f545029d46e523594a42016dc0d952f800b446c68fa642a81fbff70" }, "downloads": -1, "filename": "django-simpleapi-1.3.0.tar.gz", "has_sig": false, "md5_digest": "df38aee4a9e46d854f3fd6936ec67e21", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4755, "upload_time": "2015-01-06T07:06:03", "url": "https://files.pythonhosted.org/packages/c1/82/9026721b704bcd400cec96f6f56ca5bbf39a2982bb56545505dfdee52798/django-simpleapi-1.3.0.tar.gz" } ], "1.3.1": [ { "comment_text": "", "digests": { "md5": "6ed285f989cf411cd57bce62d83b57d0", "sha256": "88afe0dc9ff50db42c105ce1edc9c70646c5030435cb7850e324db768e7b4e21" }, "downloads": -1, "filename": "django-simpleapi-1.3.1.tar.gz", "has_sig": false, "md5_digest": "6ed285f989cf411cd57bce62d83b57d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4769, "upload_time": "2015-01-21T23:19:07", "url": "https://files.pythonhosted.org/packages/cf/90/de3c9fd13b9c66dbd5700437c37d1e8f534b6ae756d4c99bdd6fa614e086/django-simpleapi-1.3.1.tar.gz" } ], "1.4.0": [ { "comment_text": "", "digests": { "md5": "a842852620d55fd8feba68dc1b802fd9", "sha256": "fae2bfdaaec288c44059412a905a326850e55bd78d6771215a4f9bceafae49c1" }, "downloads": -1, "filename": "django-simpleapi-1.4.0.tar.gz", "has_sig": false, "md5_digest": "a842852620d55fd8feba68dc1b802fd9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4822, "upload_time": "2015-02-18T15:55:34", "url": "https://files.pythonhosted.org/packages/e3/ca/63afa2079e292ee832610b1203ae752ce8792b337916073886aa9a606530/django-simpleapi-1.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a842852620d55fd8feba68dc1b802fd9", "sha256": "fae2bfdaaec288c44059412a905a326850e55bd78d6771215a4f9bceafae49c1" }, "downloads": -1, "filename": "django-simpleapi-1.4.0.tar.gz", "has_sig": false, "md5_digest": "a842852620d55fd8feba68dc1b802fd9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4822, "upload_time": "2015-02-18T15:55:34", "url": "https://files.pythonhosted.org/packages/e3/ca/63afa2079e292ee832610b1203ae752ce8792b337916073886aa9a606530/django-simpleapi-1.4.0.tar.gz" } ] }