{ "info": { "author": "Marcos Daniel Petry", "author_email": "marcospetry@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: No Input/Output (Daemon)", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: Unix", "Programming Language :: Python :: 2.7" ], "description": "pluct\n=====\n\n.. image:: https://travis-ci.org/globocom/pluct.svg\n :target: https://travis-ci.org/globocom/pluct\n :alt: Travis CI Build Status\n\nA JSON Hyper Schema client that allows hypermedia navigation and\nresource validation.\n\nBasic Usage\n-----------\n\n.. code:: python\n\n import pluct\n\n # Load a resource\n item = pluct.resource('http://myapi.com/api/item', timeout=2) # Works with connect timeout\n\n # Verifying if the resource is valid for the current schema\n item.is_valid()\n\n # Use the resource as a dictionary\n first_title = item['subitems'][0]['title']\n\n # Accessing the item schema\n item.schema['properties']['title']\n\n # Loading a related resource\n category = item.rel('category')\n\n # With additional parameters\n category = item.rel('category', timeout=(1, 2)) # You can choose from request parameters: http://docs.python-requests.org/en/latest/api/#requests.Session.request\n\nAuthentication / Custom HTTP Client\n-----------------------------------\n\n``Pluct`` uses the `Session `_\nobject from the `requests `_ package as a HTTP client.\n\nAny other client with the same interface can be used.\n\nHere is an example using `alf `_, an OAuth 2 client:\n\n.. code:: python\n\n from pluct import Pluct\n from alf.client import Client\n\n alf = Client(\n token_endpoint='http://myapi.com/token',\n client_id='client-id',\n client_secret='secret')\n\n # Create a pluct session using the client\n pluct = Pluct(client=alf)\n item = pluct.resource('http://myapi.com/api/item')\n\nAll subsequent requests for schemas or resources in this session will\nuse the same client.\n\nParameters and URI expansion\n----------------------------\n\n`URI Templates `_ are supported when following resource links.\n\nThe context for URL expansion will be a merge of the resource ``data``\nattribute and the ``params`` parameter passed to the resource\u2019s ``rel``\nmethod.\n\nAny variable not consumed by the URL Template will be used on the query\nstring for the request.\n\nBetter explained in an example. Consider the following resource and\nschema snippets:\n\n.. code:: json\n\n {\n \"type\": \"article\"\n }\n\n.. code:: json\n\n {\n \"...\": \"...\",\n \"links\": [\n {\n \"rel\": \"search\",\n \"href\": \"/api/search/{type}\"\n }\n ]\n }\n\nThe next example will resolve the ``href`` from the ``search`` link to\n``/api/search/article?q=foo`` and will load articles containing the text\n\u201cfoo\u201d:\n\n.. code:: python\n\n import pluct\n\n # Load a resource\n item = pluct.resource('http://myapi.com/api/item')\n\n articles = item.rel('search', params={'q': 'foo'})\n\nTo search for galleries is just a matter of passing a different ``type``\nin the ``params`` argument, as follows:\n\n.. code:: python\n\n galleries = item.rel('search', params={'type': 'gallery', 'q': 'foo'})\n\nTo send your own body data you can send the object as data. This will follow\nyour method (PUT, POST, GET or DELETE) with all data from object:\n\n.. code:: python\n\n galleries = item.rel('create', data=item)\n\n\nSchema loading\n--------------\n\nWhen a resource is loaded, a lazy-schema schema will be created and its\ndata will only be loaded when accessed.\n\n``Pluct`` looks for a schema URL on the ``profile`` parameter of the\n``Content-type`` header:\n\n.. code:: python\n\n Content-Type: application/json; profile=\"http://myapi.com/api/schema\"\n\nReferences ($ref)\n-----------------\n\n`JSON Pointers `_ on schemas are\nalso supported.\n\nPointers are identified by a dictionary with a ``$ref`` key pointing to an\nexternal URL or a local pointer.\n\nConsidering the following definitions on the ``/api/definitions`` url:\n\n.. code:: json\n\n {\n \"address\": {\n \"type\": \"object\",\n \"properties\": {\n \"line1\": {\"type\": \"string\"},\n \"line2\": {\"type\": \"string\"},\n \"zipcode\": {\"type\": \"integer\"},\n }\n }\n }\n\nAnd this schema on ``/api/schema`` that uses the above definitions:\n\n.. code:: json\n\n {\n \"properties\": {\n \"shippingAddress\": {\"$ref\": \"http://myapi.com/api/definitions#/address\"},\n \"billingAddress\": {\"$ref\": \"http://myapi.com/api/definitions#/address\"},\n }\n }\n\nThe ``billingAddress`` can be accessed as follows:\n\n.. code:: python\n\n import pluct\n schema = pluct.schema('http://myapi.com/api/schema')\n\n schema['properties']['billingAddress']['zipcode'] == {\"type\": \"integer\"}\n\nContributing\n------------\n\nFork the repository on Github:\nhttps://github.com/globocom/pluct\n\nCreate a virtualenv and install the dependencies:\n\n.. code:: bash\n\n make setup\n\nTests are on the `pluct/tests` directory, run the test suite with:\n\n.. code:: bash\n\n make test", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/globocom/pluct", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "pluct", "package_url": "https://pypi.org/project/pluct/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pluct/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/globocom/pluct" }, "release_url": "https://pypi.org/project/pluct/1.2.7/", "requires_dist": null, "requires_python": null, "summary": "JSON Hyper Schema client", "version": "1.2.7" }, "last_serial": 2728870, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "ff737824a57846af5b69391f6e4cb6fe", "sha256": "ae04057ea911fafb52acc94ceb5658ca9741a32529fdc96af483508da9c80c27" }, "downloads": -1, "filename": "pluct-0.1.tar.gz", "has_sig": false, "md5_digest": "ff737824a57846af5b69391f6e4cb6fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3731, "upload_time": "2013-04-30T14:17:31", "url": "https://files.pythonhosted.org/packages/83/ee/429e814612623c9776e27c13189748814292d45d8afbad7aaa6b14b22bdb/pluct-0.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ab82c20ed25e1ac20e590b352cd37290", "sha256": "50b9fe6df69cbcef6ec0b6452ef9e71d56af3847417fa9dba09bcc3c0eb01294" }, "downloads": -1, "filename": "pluct-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ab82c20ed25e1ac20e590b352cd37290", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3029, "upload_time": "2013-06-12T20:40:15", "url": "https://files.pythonhosted.org/packages/dc/59/f4a37c304055422c27097ae349c312607c5a6875902d3119805d7e83dd02/pluct-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "d8c1d62baa1a0d2e7901af6de052a4c9", "sha256": "bec18adbf720847a060ace452ed32df629507e91e2cedbeee7aef3b6ba953544" }, "downloads": -1, "filename": "pluct-0.2.1.tar.gz", "has_sig": false, "md5_digest": "d8c1d62baa1a0d2e7901af6de052a4c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3040, "upload_time": "2013-07-04T03:36:44", "url": "https://files.pythonhosted.org/packages/43/43/9e3a759f3e38e9c354f8c0dc847952f11b0d415b62336b99e9102f0cfe44/pluct-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "dc288c8c69bb993cb6b00641fd85cbed", "sha256": "cc0d6c593a9008e6d90b997705b2b0a5564d53a3e3d41718ca8287ac59262bd7" }, "downloads": -1, "filename": "pluct-0.3.0.tar.gz", "has_sig": false, "md5_digest": "dc288c8c69bb993cb6b00641fd85cbed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3144, "upload_time": "2013-07-27T17:24:53", "url": "https://files.pythonhosted.org/packages/58/22/7621cfe9fe047c7d4b6be6098f9eb26ac81a4d0c04bca753b7fdddc6dc55/pluct-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "26fa8a017ec906ece8e0b21ccfa8887d", "sha256": "eb45f42c087076d5987e53b219263672a4898d7ccb3391ee312c80f7f0c479d8" }, "downloads": -1, "filename": "pluct-0.4.0.tar.gz", "has_sig": false, "md5_digest": "26fa8a017ec906ece8e0b21ccfa8887d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3239, "upload_time": "2013-08-07T19:15:41", "url": "https://files.pythonhosted.org/packages/bf/6b/551c8b3df8f3e25eb35528ab2d3ea3dfb1a3e1d54ca6fc6fbc1e5c3265c7/pluct-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "e17ae859b9522f07893156ac517df136", "sha256": "517ee6ea3b9fdf6b832954e65263652444e19f9a67e2be254bb1c25a2f09f1f4" }, "downloads": -1, "filename": "pluct-0.4.1.tar.gz", "has_sig": false, "md5_digest": "e17ae859b9522f07893156ac517df136", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3251, "upload_time": "2013-08-08T17:26:21", "url": "https://files.pythonhosted.org/packages/a9/a9/e36562cdfab6e0bdc369f3ff6438c37596b12fdb4986f3772130b19622b7/pluct-0.4.1.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "1b162d4d62dd7a87d57fa9493ee6deb4", "sha256": "0e3ce8782cc67a5bc37a7075c3f4990de063ac3186b6db61e1b375cac93888c0" }, "downloads": -1, "filename": "pluct-0.5.0.tar.gz", "has_sig": false, "md5_digest": "1b162d4d62dd7a87d57fa9493ee6deb4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3340, "upload_time": "2013-08-21T16:20:06", "url": "https://files.pythonhosted.org/packages/41/43/6053493a5d15e5394b4ac5f696a62620e0375298d394ed141eb882b05a0e/pluct-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "5b9fa3249f55103cd653cee7e4838e7f", "sha256": "e7a88798b74efc5b049f8a4680bb7fa52354ca67d08fe52e581c2b86e637e8e1" }, "downloads": -1, "filename": "pluct-0.6.0.tar.gz", "has_sig": false, "md5_digest": "5b9fa3249f55103cd653cee7e4838e7f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3781, "upload_time": "2014-07-31T14:12:53", "url": "https://files.pythonhosted.org/packages/4e/be/e6030f79b2856d435e41f4df83ce78851108b4e8b02bb915a2a2976c0b38/pluct-0.6.0.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "03c789ab00d724110d605c5dbed33cec", "sha256": "6b3b905b74d55a68700d3bc28f53e6f3d4a7fda382edc2d5217baabfa4d4e1bf" }, "downloads": -1, "filename": "pluct-0.7.0.tar.gz", "has_sig": false, "md5_digest": "03c789ab00d724110d605c5dbed33cec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3765, "upload_time": "2014-08-07T16:41:05", "url": "https://files.pythonhosted.org/packages/77/a1/b490bb63e1b03e046ea56ab7f562875a200de4be1b481be17dc83e33c76b/pluct-0.7.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "d6a033ac20fa3a5c747ed976a499547e", "sha256": "0a1b1d011c23d35d9985b27e32e0ce41fb0927555e9f27f9cb555ffab4814722" }, "downloads": -1, "filename": "pluct-1.0.0.tar.gz", "has_sig": false, "md5_digest": "d6a033ac20fa3a5c747ed976a499547e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6006, "upload_time": "2014-09-04T12:03:50", "url": "https://files.pythonhosted.org/packages/5a/04/00919933471a9229aa6cbaf799f7ee621102b50ae7d55247eef27f8afc2e/pluct-1.0.0.tar.gz" } ], "1.0.0-beta": [ { "comment_text": "", "digests": { "md5": "db095ef3cee4a98dbabb0ba832a010a1", "sha256": "3c6a15eea66d50b695cfc2bedf5c8ce4d241320768b615cde3daa1e93a362901" }, "downloads": -1, "filename": "pluct-1.0.0-beta.tar.gz", "has_sig": false, "md5_digest": "db095ef3cee4a98dbabb0ba832a010a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5883, "upload_time": "2014-08-26T21:17:30", "url": "https://files.pythonhosted.org/packages/bc/ed/91ae9972f603fe3dbc7cba1c64fcc3674e38ac311321cbbaaa10005bc2e5/pluct-1.0.0-beta.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "fe775b6c10287f8e682efa71169b325f", "sha256": "c152f0667bec8f578a95d68b11860a8b3e67b439e49888bf1ae9c6171dfd1aa3" }, "downloads": -1, "filename": "pluct-1.1.0.tar.gz", "has_sig": false, "md5_digest": "fe775b6c10287f8e682efa71169b325f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5985, "upload_time": "2014-10-23T17:57:24", "url": "https://files.pythonhosted.org/packages/6d/73/2a2e136404163c067881d12ca197851b937a4f90964ee7cb159ef9238f42/pluct-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "77ebc881b49a3eb63abaf06183ae93b3", "sha256": "26e3996b0b84eafbad442d50aab33b378094e239ea1510121918a9176c05a67f" }, "downloads": -1, "filename": "pluct-1.2.0.tar.gz", "has_sig": false, "md5_digest": "77ebc881b49a3eb63abaf06183ae93b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5982, "upload_time": "2014-12-03T18:51:01", "url": "https://files.pythonhosted.org/packages/b0/54/89b213304d160b5865de444872e085388b4914a441e91e495380add174aa/pluct-1.2.0.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "daafba9c204c0c3730b156af60b7cb35", "sha256": "603aea564d050e1c90e0d511d7056aafeaf8a9a168130e6dfbe8582e2ff2b2ac" }, "downloads": -1, "filename": "pluct-1.2.1.tar.gz", "has_sig": false, "md5_digest": "daafba9c204c0c3730b156af60b7cb35", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6147, "upload_time": "2015-02-24T14:01:22", "url": "https://files.pythonhosted.org/packages/3b/7e/a82d22025991257c6c1916d3e1a130f3926546c3c5bd07e6dcd47d13d061/pluct-1.2.1.tar.gz" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "d5c96a775a409e2636c1073eba61429c", "sha256": "21c065e37f0e090c7d5a185e4165bd0b022543e567f0c8884a7eb10b64130027" }, "downloads": -1, "filename": "pluct-1.2.2.tar.gz", "has_sig": false, "md5_digest": "d5c96a775a409e2636c1073eba61429c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6082, "upload_time": "2015-03-05T17:51:49", "url": "https://files.pythonhosted.org/packages/9e/d2/f1aec526bdf3df5ab447609046f50f182bcdcd1e0d4a2a56ef06fc3ad05a/pluct-1.2.2.tar.gz" } ], "1.2.3": [ { "comment_text": "", "digests": { "md5": "ecb6de63beef24474f5ff738fee75f86", "sha256": "2784e858d56e7155ae92c365898347ccd0fb523f34c936214e8521e67fa08ebb" }, "downloads": -1, "filename": "pluct-1.2.3.tar.gz", "has_sig": false, "md5_digest": "ecb6de63beef24474f5ff738fee75f86", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6356, "upload_time": "2015-08-10T18:00:19", "url": "https://files.pythonhosted.org/packages/a2/ce/a0cbe31836a8f3ef62a89fd4ccee34a8abf049a8b650377df009ff9a0bdf/pluct-1.2.3.tar.gz" } ], "1.2.4": [ { "comment_text": "", "digests": { "md5": "be2a6f7c4b9c442f7b7d3d13a2fc724d", "sha256": "9904bfb5d73be1bf185e309a257759246590b30cf06fa0043297dbe976b06050" }, "downloads": -1, "filename": "pluct-1.2.4.tar.gz", "has_sig": false, "md5_digest": "be2a6f7c4b9c442f7b7d3d13a2fc724d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6305, "upload_time": "2015-08-10T18:18:02", "url": "https://files.pythonhosted.org/packages/ec/41/940fb5de403ffe3a816742cccb2ba46ce303395d798718e95dfe2cfdfc82/pluct-1.2.4.tar.gz" } ], "1.2.5": [ { "comment_text": "", "digests": { "md5": "20ed4091eccd3b7a416008425b3f48b0", "sha256": "5e7fd493bd3cedf5714efbdb69dfcb6cd9b905a2a1ae4876847e38846dd0a204" }, "downloads": -1, "filename": "pluct-1.2.5.tar.gz", "has_sig": false, "md5_digest": "20ed4091eccd3b7a416008425b3f48b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6431, "upload_time": "2015-11-23T20:06:14", "url": "https://files.pythonhosted.org/packages/96/47/3660f5d2160035b071b15d4765b83ea580e465c0b4cd4e0f82bd4ca30b9d/pluct-1.2.5.tar.gz" } ], "1.2.6": [ { "comment_text": "", "digests": { "md5": "e1ef45e9cb0f25211ffce04aa299a422", "sha256": "0a60b753bfe3be3dc781af2029e33a4026008a179e4f87b31dea6b57a1dca222" }, "downloads": -1, "filename": "pluct-1.2.6.tar.gz", "has_sig": false, "md5_digest": "e1ef45e9cb0f25211ffce04aa299a422", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6526, "upload_time": "2015-11-24T18:48:43", "url": "https://files.pythonhosted.org/packages/92/11/11d9d98c8ebc8e5a6d2b9df4cbf88ab7df9a32d5b07fe6733928ba0a0a48/pluct-1.2.6.tar.gz" } ], "1.2.7": [ { "comment_text": "", "digests": { "md5": "123f9372eaf304a9637a6f16436fcda4", "sha256": "1d6a771b33ca5c5e830fc60abd3a526f6a1ee868a5afad784353d36c0a7abe33" }, "downloads": -1, "filename": "pluct-1.2.7.tar.gz", "has_sig": false, "md5_digest": "123f9372eaf304a9637a6f16436fcda4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6530, "upload_time": "2016-03-21T19:58:44", "url": "https://files.pythonhosted.org/packages/5d/02/dc38be684d767642e7c5da5d74f52fabce0100c0e81352eb160afb2175de/pluct-1.2.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "123f9372eaf304a9637a6f16436fcda4", "sha256": "1d6a771b33ca5c5e830fc60abd3a526f6a1ee868a5afad784353d36c0a7abe33" }, "downloads": -1, "filename": "pluct-1.2.7.tar.gz", "has_sig": false, "md5_digest": "123f9372eaf304a9637a6f16436fcda4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6530, "upload_time": "2016-03-21T19:58:44", "url": "https://files.pythonhosted.org/packages/5d/02/dc38be684d767642e7c5da5d74f52fabce0100c0e81352eb160afb2175de/pluct-1.2.7.tar.gz" } ] }