{"comment":{"created_at":"2011-10-17T21:34:25Z","body":"By the way, some time ago, I found that API v2 does not support \"page\" argument in few places. I don't remember which exactly, but they won't fix it and advice to use API v3, where nice pageration is available, using \"Link\" http header.","updated_at":"2011-10-17T21:34:25Z","url":"https://api.github.com/repos/ask/python-github2/issues/comments/2435117","id":2435117,"user":{"gravatar_id":"5b3558b0fd5ca9c08d9061a6e51b555a","avatar_url":"https://secure.gravatar.com/avatar/5b3558b0fd5ca9c08d9061a6e51b555a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/svetlyak40wt","id":24827,"login":"svetlyak40wt"}},"action":"created","issue":{"number":66,"created_at":"2011-10-17T21:04:55Z","pull_request":{"diff_url":"https://github.com/ask/python-github2/pull/66.diff","patch_url":"https://github.com/ask/python-github2/pull/66.patch","html_url":"https://github.com/ask/python-github2/pull/66"},"body":"For each method asking github for a list, i added a `page` parameter, default to None.\r\n\r\nThe `get_values` method catch this paramter and then create (or update) a `post_data` paramter sent to `make_request`.\r\n\r\nThere is no easy way with the current code to know how much pages exist for a given list, so it's up to the user to manage the number of pages to retrieve.\r\n\r\nIn my code i do something like this:\r\n\r\n```python\r\n# store all data from all pages\r\nresult = []\r\n# start with page one\r\npage = 1\r\n# we don't know yet the max length of a page\r\nmax_length = 0\r\n\r\nwhile True:\r\n    # get data for the current page\r\n    page_result = github.repos.watching(username, page=page)\r\n    # no result ? it's the end\r\n    if not page_result:\r\n        break\r\n    # save the result\r\n    result += page_result\r\n    # check length of result\r\n    l_page = len(page_result)\r\n    # if smaller than max, it's the last page\r\n    if l_page < max_length:\r\n        break\r\n    # if bigger, it's the new max\r\n    if l_page > max_length:\r\n        max_length = l_page\r\n    # go next page\r\n    page += 1\r\n\r\nreturn result\r\n```    \r\n","comments":2,"title":"Pagination support for lists","updated_at":"2011-10-17T21:34:25Z","url":"https://api.github.com/repos/ask/python-github2/issues/66","id":1933425,"assignee":null,"milestone":null,"closed_at":null,"user":{"gravatar_id":"4929cd99d0f54b7fa03081f9ab8bb0d4","avatar_url":"https://secure.gravatar.com/avatar/4929cd99d0f54b7fa03081f9ab8bb0d4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/twidi","id":193474,"login":"twidi"},"html_url":"https://github.com/ask/python-github2/issues/66","labels":[],"state":"open"},"legacy":{"issue_id":1933425,"comment_id":2435117}}