{ "info": { "author": "chris48s", "author_email": "", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": "# json-paginator\n\n![PyPI Version](https://img.shields.io/pypi/v/json-paginator.svg)\n![License](https://img.shields.io/pypi/l/json-paginator.svg)\n\nA generator for iterating over paginated JSON API responses\n\n## Installation\n\n```\npip install json-paginator\n```\n\n## Usage\n\nInstantiate `JsonApiPaginator` with:\n\n* A URL to page 1 of the API output\n* A function (or lambda) `get_nextpage(url, body)` which describes how to get the next page. Return `None` to stop iteration.\n\nExample:\n\n```py\nfrom json_paginator import JsonApiPaginator\n\nBASE = 'https://galaxy.ansible.com'\n\ndef get_next_page(url, body):\n if body['next_link']:\n return BASE + body['next_link']\n return None\n\n# instantiate the paginator\npages = JsonApiPaginator(\n BASE + '/api/v1/categories/?page=1',\n get_next_page\n)\n\n# iterate over the pages\nfor url, body in pages:\n print(\"calling %s\" % (url))\n print(\"found %s results\" % (len(body['results'])))\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/chris48s/json-paginator", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "json-paginator", "package_url": "https://pypi.org/project/json-paginator/", "platform": "", "project_url": "https://pypi.org/project/json-paginator/", "project_urls": { "Homepage": "https://github.com/chris48s/json-paginator" }, "release_url": "https://pypi.org/project/json-paginator/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "A generator for iterating over paginated JSON API responses", "version": "0.1.0" }, "last_serial": 4500244, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e32485c007c0431588888780229764e9", "sha256": "a9f7242b9fcdb38815cfe30842963715a3eac46c102ff5560dedadb9ddad2681" }, "downloads": -1, "filename": "json-paginator-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e32485c007c0431588888780229764e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1808, "upload_time": "2018-11-18T16:53:22", "url": "https://files.pythonhosted.org/packages/f9/f0/1b8692954bb68fbaad537a09fc2ac61883d92f9666e6b7ccbc97611e3203/json-paginator-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e32485c007c0431588888780229764e9", "sha256": "a9f7242b9fcdb38815cfe30842963715a3eac46c102ff5560dedadb9ddad2681" }, "downloads": -1, "filename": "json-paginator-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e32485c007c0431588888780229764e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1808, "upload_time": "2018-11-18T16:53:22", "url": "https://files.pythonhosted.org/packages/f9/f0/1b8692954bb68fbaad537a09fc2ac61883d92f9666e6b7ccbc97611e3203/json-paginator-0.1.0.tar.gz" } ] }