{ "info": { "author": "Namlook", "author_email": "UNKNOWN", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Other Environment", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "RestDyn\n=======\n\nRestDyn is a dynamic rest client built on top of the excellent restkit_ library.\n\n.. _restkit : http://github.com/benoitc/restkit\n\nIt aims to be able to handle any uris for any apis.\n\nHow it work ?\n-------------\n\nLet's say we want to fetch the json API of the great service http://www.example.com. Their api is served from http://api.example.com/1.0/::\n\n >>> from restdyn import Client\n >>> ExampleAPI = Client('http://api.example.com/1.0/')\n\nNow we want to get the result from http://api.example.com/1.0/users/search?q=Timy::\n\n >>> results = ExampleAPI.users.search(q='Timy')\n\nThat's it ! `results` is a json object.\n\nGoing further\n-------------\n\nAdding arguments automatically\n++++++++++++++++++++++++++++++\n\nSometimes some api are a bit tricky. Previously, the version of the api was part of the resource but what if we have to specify it for each request::\n\n http://api.example.com/user/search?v=1.0&q=Timy\n\nWe can specify one or more params which will be automatically add to the query::\n\n >>> ExampleAPI = Client('http://api.example.com')\n >>> ExampleAPI.set_persistent_params(v=\"1.0\")\n\nor you can pass a dict::\n\n >>> ExampleAPI.set_persistent_params({'v':'1.0'})\n\n\nCustomize resources\n+++++++++++++++++++\n\nSome apis like Twitter add `.json` after the resource but before the query : https://api.twitter.com/1/search.json&q=Timy. We can do it like this::\n\n >>> TwitterAPI = Client('https://api.twitter.com/1', end_resource='.json')\n >>> results = TwitterAPI.search(q='Timy')\n\nPost process result\n+++++++++++++++++++\n\nSometimes you may have to clean up the result before send it back. You can do it by overloading the `Client.post_process_result` method.\n\nExample:\n\n Google's web service won't send an http error 400 if the request failed. Instead, it will send a custom result::\n\n http://ajax.googleapis.com/ajax/services/search/web?q=Earth%20Day\n\nwill send back::\n\n {\"responseData\": null, \"responseDetails\": \"invalid version\", \"responseStatus\": 400}\n\nLet's say we want to catch the error and raise an RequestFailed exception with a custom message which is in the \"responseDetails\" field::\n\n class CustomGoogleAPI(Client):\n def post_process_result(self, result):\n if result[\"responseStatus\"] == 400:\n raise RequestFailed(result['responseDetails'])\n return result\n\nThat's it ! Don't forget to return the result at the end of the `post_process_result` method.\n\n >>> GoogleAPI = CustomGoogleAPI('http://ajax.googleapis.com/ajax/services')\n >>> GoogleAPI.search.web(q=\"toto\")\n Traceback (most recent call last):\n ...\n RequestFailed: invalid version\n\nAdding a trailing slash\n+++++++++++++++++++++++\n\nIf the api you are dealing have a slash in all its urls, you can configure restdyn to add it::\n\n >>> example_api = Client('http://api.example.com', add_trailing_slash=True)", "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/namlook/restdyn", "keywords": null, "license": "New BSD License", "maintainer": null, "maintainer_email": null, "name": "restdyn", "package_url": "https://pypi.org/project/restdyn/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/restdyn/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/namlook/restdyn" }, "release_url": "https://pypi.org/project/restdyn/0.3/", "requires_dist": null, "requires_python": null, "summary": "A dynamic rest client", "version": "0.3" }, "last_serial": 798904, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "2e5e749bcbe7fb4470d1b5789f7d756a", "sha256": "7a685fa857f46cc1389dd708c10d406925f163ee28ab4c92752e697e6234334b" }, "downloads": -1, "filename": "restdyn-0.1.tar.gz", "has_sig": false, "md5_digest": "2e5e749bcbe7fb4470d1b5789f7d756a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6570, "upload_time": "2011-08-31T11:23:34", "url": "https://files.pythonhosted.org/packages/03/da/f17b4731948dd910145cf428425f04f5e61c5b02935f0cb9daefc046f35e/restdyn-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "1c5fe904b5afcb4d1df4db86512bb35b", "sha256": "a042cc3563e2412f11d8594324d49e79a80cebe340d1b8f92726daf390351898" }, "downloads": -1, "filename": "restdyn-0.2.tar.gz", "has_sig": false, "md5_digest": "1c5fe904b5afcb4d1df4db86512bb35b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5139, "upload_time": "2011-09-01T10:46:13", "url": "https://files.pythonhosted.org/packages/89/85/d8482df491bc5e00459251467e306c29b7fa6e380da93eee922d0b97d4b5/restdyn-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "1e8fd188d715bd5b058570c6f04fd5f8", "sha256": "ebda021a82f9a550ec2fc21b1d6df9c040ec9539035b4b01f198040cbe092b32" }, "downloads": -1, "filename": "restdyn-0.3.tar.gz", "has_sig": false, "md5_digest": "1e8fd188d715bd5b058570c6f04fd5f8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 84272, "upload_time": "2011-09-02T17:21:28", "url": "https://files.pythonhosted.org/packages/7e/6c/0cf889ce04df3a6a27100602ebb1802ef0448b11da5ed3346fdec545cdac/restdyn-0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1e8fd188d715bd5b058570c6f04fd5f8", "sha256": "ebda021a82f9a550ec2fc21b1d6df9c040ec9539035b4b01f198040cbe092b32" }, "downloads": -1, "filename": "restdyn-0.3.tar.gz", "has_sig": false, "md5_digest": "1e8fd188d715bd5b058570c6f04fd5f8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 84272, "upload_time": "2011-09-02T17:21:28", "url": "https://files.pythonhosted.org/packages/7e/6c/0cf889ce04df3a6a27100602ebb1802ef0448b11da5ed3346fdec545cdac/restdyn-0.3.tar.gz" } ] }