{ "info": { "author": "Andrey Petrov", "author_email": "andrey.petrov@shazow.net", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries" ], "description": "Tiny framework for building *good* API client libraries thanks to\n`urllib3 `_.\n\nHighlights\n==========\n\n- Threadsafely reuses connections with Keep-Alive (via urllib3).\n- Small and easy to understand codebase perfect for extending and building upon.\n- Built-in support for rate limiting and request throttling.\n- Functional examples for the\n `Klout API `_\n and the\n `Facebook OpenGraph API `_.\n\n\nExamples\n========\n\nHow to make your own super-simple client API library::\n\n >>> from apiclient import APIClient\n >>> class AcmePublicAPI(APIClient):\n ... BASE_URL = 'https://localhost:1234/'\n\n >>> acme_api = AcmePublicAPI()\n\n >>> acme_api.call('/hello')\n {'what': 'world'}\n >>> acme_api.call('/echo', params={\"ping\": \"pong\"})\n {'ping': 'pong'}\n\n\nHow to add rate limiting to your client API library so that we don't exceed 10\nrequests per minute::\n\n >>> from apiclient import RateLimiter\n >>> lock = RateLimiter(max_messages=10, every_seconds=60)\n >>> acme_api = AcmePublicAPI(rate_limit_lock=lock)\n\n >>> # Get the first 100 pages\n >>> for page in xrange(100):\n ... # Whenever our request rate exceeds the specifications of the API's\n ... # RateLimiter, the next request will block until the next request window\n ... r = acme_api.call('/stream', page=str(page))\n\nFor more specific API examples, see the\n`examples/ `_ directory.\n\n\nExtending\n=========\n\nTo handle different calling conventions, ``apiclient`` can be extended through\nsubclassing.\n\nFor example, if an API requires that all arguments be JSON encoded, the\n``_compose_url`` method could be implemented like this::\n\n >>> class JSONArgsAPIClient(APIClient):\n ... def _compose_url(self, path, params=None):\n ... if params is not None:\n ... params = dict((key, json.dumps(val))\n ... for (key, val) in params.iteritems())\n ... return APIClient._compose_url(self, path, params=params)\n\nOr if an API returns YAML instead of JSON, the ``_handle_response`` method\ncould be overridden::\n\n >>> class YAMLResponseAPIClient(APIClient):\n ... def _handle_response(self, response):\n ... return yaml.load(response.data)\n\n\nTODO\n====\n\n- Tests.\n- More documentation.\n- More types of API handshakes, like OAuth and OAuth2.\n- More examples.\n\n\nContributing\n============\n\nAny contribution is highly encouraged and desired. :)\n\n#. Fork on Github.\n#. Make the changes. Bonus points if changes include documentation and tests.\n#. Send a pull request.\n\nIf you're unsure if it's a good idea,\n`open an Issue `_ or\n`contact me `_ to discuss your proposal.\nExtra juicy bonus points if you pick off some of the items in the **TODO** list.\n\n\nLicense\n=======\n\n`MIT `_\n\n\nChanges\n=======\n\n1.0.3 (2016-05-15)\n------------------\n\n* Python 3 fixes.\n\n\n1.0.2 (2011-10-20)\n------------------\n\n* Fixed setup.py from failing upon not seeing README.rst when installing using\n easy_install.\n\n\n1.0.1 (2011-10-10)\n------------------\n\n* Fixed setup.py package not including a MANIFEST.in\n\n\n1.0 (2011-10-03)\n----------------\n\n* Published decoupled code from SocialGrapple.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/shazow/apiclient", "keywords": "api client urllib3 keepalive threadsafe http rest", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "apiclient", "package_url": "https://pypi.org/project/apiclient/", "platform": "", "project_url": "https://pypi.org/project/apiclient/", "project_urls": { "Homepage": "https://github.com/shazow/apiclient" }, "release_url": "https://pypi.org/project/apiclient/1.0.4/", "requires_dist": null, "requires_python": "", "summary": "Framework for making good API client libraries using urllib3.", "version": "1.0.4" }, "last_serial": 4966174, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "000edd2d9d1066a2a9e1cf72bb22c522", "sha256": "ba6d761bf43f462c7dbec6c38f43448f2b2dc1d69dbcb8faae56af0041bca5ee" }, "downloads": -1, "filename": "apiclient-1.0.tar.gz", "has_sig": false, "md5_digest": "000edd2d9d1066a2a9e1cf72bb22c522", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2908, "upload_time": "2011-10-04T03:13:49", "url": "https://files.pythonhosted.org/packages/0d/b6/c9a5252187cd2f66b3b418001e2eb842480e9f82f72063b7b64add635c25/apiclient-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "f94461033e51a109956e7c154c5e365a", "sha256": "2df24b8b78c4bc691576e516059d3493af52877a53cb1fcde6ba8347cc2f3add" }, "downloads": -1, "filename": "apiclient-1.0.1.tar.gz", "has_sig": false, "md5_digest": "f94461033e51a109956e7c154c5e365a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4652, "upload_time": "2011-10-19T18:49:25", "url": "https://files.pythonhosted.org/packages/5f/a9/d12059078eca0ca6d7e360c067faec9a72d1bc24cd9a9400573872594ddd/apiclient-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "3f7444f26c0c0417fdf598fd0ab46a79", "sha256": "3436a3b37582427166ef1ddbfb532e8f7a1203fe360332e4db1bd0a13e6b3609" }, "downloads": -1, "filename": "apiclient-1.0.2.tar.gz", "has_sig": false, "md5_digest": "3f7444f26c0c0417fdf598fd0ab46a79", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4758, "upload_time": "2011-10-21T00:12:45", "url": "https://files.pythonhosted.org/packages/8c/60/4847d01cc37dcd75cf6e0640712c9ee79da97a94e181e3aa85f2a8c3a76a/apiclient-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "2e7259570bc3f3469af6a4b71f38933d", "sha256": "49d1b5a6eb36281461a931243c142ea57cffcfd125ae399bf59421cccf6836c4" }, "downloads": -1, "filename": "apiclient-1.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "2e7259570bc3f3469af6a4b71f38933d", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6737, "upload_time": "2016-05-15T22:08:57", "url": "https://files.pythonhosted.org/packages/e6/7e/86811aa7e86883291f4cf4f7dc027be74f745ef9e096b1cd2375247a64ed/apiclient-1.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b7caa05b6c41ab6a852ad8501359a5a7", "sha256": "e97b1bb13646df12284a8915c99728f380fb9a3edbeb2c20927cf47afd73d0ac" }, "downloads": -1, "filename": "apiclient-1.0.3.tar.gz", "has_sig": false, "md5_digest": "b7caa05b6c41ab6a852ad8501359a5a7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4811, "upload_time": "2016-05-15T22:09:07", "url": "https://files.pythonhosted.org/packages/b6/5e/08d11020ba6087be7352c8a1856d3a6601f9f1aa7ea434ef1c584b489325/apiclient-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "4433cdad604736536b3d56a2dc633ff6", "sha256": "2569c998191cd1a042beffa3cf7c1119277237b4ba1fa021d20c81fa98fa95e9" }, "downloads": -1, "filename": "apiclient-1.0.4.tar.gz", "has_sig": false, "md5_digest": "4433cdad604736536b3d56a2dc633ff6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4912, "upload_time": "2019-03-21T00:55:53", "url": "https://files.pythonhosted.org/packages/f1/93/d36bc33f0b1cfbb7c2b5e3057586abc500aa49f0c1d8fb32af347319c1ca/apiclient-1.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4433cdad604736536b3d56a2dc633ff6", "sha256": "2569c998191cd1a042beffa3cf7c1119277237b4ba1fa021d20c81fa98fa95e9" }, "downloads": -1, "filename": "apiclient-1.0.4.tar.gz", "has_sig": false, "md5_digest": "4433cdad604736536b3d56a2dc633ff6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4912, "upload_time": "2019-03-21T00:55:53", "url": "https://files.pythonhosted.org/packages/f1/93/d36bc33f0b1cfbb7c2b5e3057586abc500aa49f0c1d8fb32af347319c1ca/apiclient-1.0.4.tar.gz" } ] }