{ "info": { "author": "Will Harris", "author_email": "will@greatlibrary.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Dougrain\n========\n\nDougrain is a Python library to help you work with the JSON variant of the\n`Hypertext Application Language `_\n(HAL). It uses Python objects to represent the JSON document, so you can use\nit with whichever JSON library you prefer.\n\nStatus\n------\n\n.. image:: https://travis-ci.org/wharris/dougrain.png?branch=master\n :alt: build status\n :target: https://travis-ci.org/wharris/dougrain\n\nThis is a pre-release version. It usually works pretty well, but the API may\nhave breaking changes in minor releases until version 1.0. The HAL\nspecification is still being developed, so Dougrain is unlikely to have a\nstable API until HAL itself is stable.\n\nCompatibility\n-------------\n\nJSON HAL drafts **3**, **4**, and **5**. Python **2.7**, **3.2**, and **3.3**.\n\nThis version conforms to `JSON Hypermedia API Language Internet Draft 5\n`_,\nbut it can also work with JSON from\n`Draft 4 `_ and\n`Draft 3 `_.\nThe draft version can be explicitly selected when the document is constructed,\nbut the default behavior is for documents to automatically detect which draft\nto use.\n\nThis version is tested on Python 2.7, including PyPy, Python 3.2, and\nPython 3.3.\n\nInstallation\n------------\n\nYou'll probably need to use sudo on the install commands, or run in a\nvirtualenv.\n\nThe easiest way to install the current release is to use pip:\n\n::\n\n $ pip install dougrain\n\nYou can install a local copy of the source in the usual way:\n\n::\n\n $ cd dougrain\n $ pip install -r requirements.txt\n $ python setup.py install\n\nExample\n-------\n\n``Document.from_object`` loads HAL data from a ``dict``:\n\n::\n\n >>> from dougrain import Document\n >>> doc = Document.from_object(\n ... {\n ... \"_embedded\": {\n ... \"r:post\": {\n ... \"_links\": {\n ... \"self\": {\n ... \"href\": \"/1\"\n ... }, \n ... \"r:site\": {\n ... \"href\": \"/\"\n ... }\n ... }, \n ... \"name\": \"First child\"\n ... }\n ... }, \n ... \"welcome\": \"Hi there!\", \n ... \"_links\": {\n ... \"curies\": [\n ... {\n ... \"href\": \"http://localhost/rels/{rel}\", \n ... \"name\": \"r\",\n ... \"templated\": True\n ... }\n ... ], \n ... \"self\": {\n ... \"href\": \"/\"\n ... },\n ... \"r:post\": {\n ... \"href\": \"/1\"\n ... },\n ... \"r:tags\": {\n ... \"href\": \"/tags\"\n ... }\n ... }\n ... },\n ... base_uri=\"http://localhost/\")\n\n``Document`` instances provide methods to interrogate the document's\nproperties, links, and embedded resources.\n\n::\n\n >>> doc.properties['welcome']\n 'Hi there!'\n >>> doc.links['r:tags'].url()\n 'http://localhost/tags'\n >>> doc.embedded['r:post'].url()\n 'http://localhost/1'\n\nLink relations can be specified using CURIEs or URI references:\n\n::\n\n >>> doc.links['r:tags'].url()\n 'http://localhost/tags'\n >>> doc.links['/rels/tags'].url()\n 'http://localhost/tags'\n\n``Builder`` provides a lightweight API for building HAL resources from scratch.\nMany of ``Builder``'s methods can be chained:\n\n::\n\n >>> from dougrain import Builder\n >>> new_post = (Builder(\"/2\").set_property('name', \"Second Child\")\n ... .add_curie('admin', \"/adminrels/{rel}\")\n ... .add_link('admin:privacy', \"/2/privacy\"))\n >>> import json\n >>> print(json.dumps(new_post.as_object(), indent=2))\n {\n \"_links\": {\n \"curies\": [\n {\n \"href\": \"/adminrels/{rel}\", \n \"name\": \"admin\", \n \"templated\": true\n }\n ], \n \"self\": {\n \"href\": \"/2\"\n }, \n \"admin:privacy\": {\n \"href\": \"/2/privacy\"\n }\n }, \n \"name\": \"Second Child\"\n }\n\n``Builder`` and ``Document`` can be used together. For example,\n``Document.embed`` will accept a ``Builder`` instance:\n\n::\n\n >>> doc.embed('r:post', new_post)\n >>> [post.properties['name'] for post in doc.embedded['/rels/post']]\n ['First child', 'Second child']", "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/wharris/dougrain/", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "dougrain", "package_url": "https://pypi.org/project/dougrain/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/dougrain/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/wharris/dougrain/" }, "release_url": "https://pypi.org/project/dougrain/0.5.1/", "requires_dist": null, "requires_python": null, "summary": "HAL JSON parser and generator", "version": "0.5.1" }, "last_serial": 851923, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "deba4d3d721b76f76bbb8c7c27d703ab", "sha256": "276cce517d44da2138f9ab664b137bfd4ea2320977a8884badb7f5abe2233c95" }, "downloads": -1, "filename": "dougrain-0.1.tar.gz", "has_sig": false, "md5_digest": "deba4d3d721b76f76bbb8c7c27d703ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8418, "upload_time": "2013-01-10T12:07:02", "url": "https://files.pythonhosted.org/packages/99/b8/1969f3dd6d46e8e5ba89a9abf36b7770bb72c93e6fabc3108dcb691ceac6/dougrain-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "39f559353e25451a9712be37f40aff47", "sha256": "9612096909c3e96d644f006edf7c33d9e48266bd3bdb4a777fd719257a20e6e9" }, "downloads": -1, "filename": "dougrain-0.2.tar.gz", "has_sig": false, "md5_digest": "39f559353e25451a9712be37f40aff47", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13073, "upload_time": "2013-02-05T09:48:35", "url": "https://files.pythonhosted.org/packages/2b/1d/b13fcc9e99992af8dc31e92ab20d0d4d96a81e00949c76c3018fd0126996/dougrain-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "8131a0f0d3e9ea9af0844f3adfb5cf55", "sha256": "9c5206910406671dcc69a030272ed54a61bafa58ea0e839afe453bd6ce3ad4eb" }, "downloads": -1, "filename": "dougrain-0.3.tar.gz", "has_sig": false, "md5_digest": "8131a0f0d3e9ea9af0844f3adfb5cf55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14500, "upload_time": "2013-03-01T10:26:15", "url": "https://files.pythonhosted.org/packages/80/ea/84088a439c05707ddcfdf895051dc12715c92faf1f09350656013dde1f2d/dougrain-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "a50f641b4f8aa4254a2c1deb334d6c21", "sha256": "436b0d8e81f9789acd880f2a17fad752a9bf6e05cd74973e729325bcc1362846" }, "downloads": -1, "filename": "dougrain-0.4.tar.gz", "has_sig": false, "md5_digest": "a50f641b4f8aa4254a2c1deb334d6c21", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16314, "upload_time": "2013-04-29T19:06:31", "url": "https://files.pythonhosted.org/packages/b8/a0/9285d12b81622900b315a02da24307ed056a5bdb7be08275a3667480df43/dougrain-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "cdf78f9b4a884be5083dde0e26994a00", "sha256": "7c30e7dcb2a18d13dcb92345939fd0590639b5370628f972557fb96e69dbc473" }, "downloads": -1, "filename": "dougrain-0.5.tar.gz", "has_sig": false, "md5_digest": "cdf78f9b4a884be5083dde0e26994a00", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22634, "upload_time": "2013-07-02T08:40:24", "url": "https://files.pythonhosted.org/packages/63/42/044d6fc195b5db406400ce613a9a79332b5d4431d3b4ba0d81918332ac82/dougrain-0.5.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "4423145657b361b5c3632b9a31f6cdc3", "sha256": "20170c81cd743671ef729399fc59d678c947a83d2aa45855da00f2e1a645e638" }, "downloads": -1, "filename": "dougrain-0.5.1.tar.gz", "has_sig": false, "md5_digest": "4423145657b361b5c3632b9a31f6cdc3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23741, "upload_time": "2013-08-29T10:32:06", "url": "https://files.pythonhosted.org/packages/ae/60/fb9caaaf878440d378a31078e80afd50640c437a1d95bbbb987f1a316f78/dougrain-0.5.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4423145657b361b5c3632b9a31f6cdc3", "sha256": "20170c81cd743671ef729399fc59d678c947a83d2aa45855da00f2e1a645e638" }, "downloads": -1, "filename": "dougrain-0.5.1.tar.gz", "has_sig": false, "md5_digest": "4423145657b361b5c3632b9a31f6cdc3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23741, "upload_time": "2013-08-29T10:32:06", "url": "https://files.pythonhosted.org/packages/ae/60/fb9caaaf878440d378a31078e80afd50640c437a1d95bbbb987f1a316f78/dougrain-0.5.1.tar.gz" } ] }