aboutsummaryrefslogtreecommitdiffstats
path: root/pygithub3/core
diff options
context:
space:
mode:
authorDavid Medina <davidmedina9@gmail.com>2012-03-01 19:41:46 +0100
committerDavid Medina <davidmedina9@gmail.com>2012-03-01 19:43:26 +0100
commit5d7ee35eb23f193ec79a1a7b24ea87c6f1bc28b8 (patch)
treec90ab9489c5217151c1f1c716aea8fa39b303393 /pygithub3/core
parentWIP on services.repos doc (diff)
downloadpython-github3-5d7ee35eb23f193ec79a1a7b24ea87c6f1bc28b8.tar.xz
python-github3-5d7ee35eb23f193ec79a1a7b24ea87c6f1bc28b8.zip
Complete services.repos doc
Also add Mimetypes doc
Diffstat (limited to 'pygithub3/core')
-rw-r--r--pygithub3/core/result.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/pygithub3/core/result.py b/pygithub3/core/result.py
index 9e69e7d..5a2aa80 100644
--- a/pygithub3/core/result.py
+++ b/pygithub3/core/result.py
@@ -137,6 +137,38 @@ class Page(object):
class Result(object):
"""
Result is a very lazy paginator. It only do a real request when is needed
+
+ You have several ways to consume it
+
+ #. Iterating over the result::
+
+ result = some_request()
+ for page in result:
+ for resource in page:
+ print resource
+
+ #. With a generator::
+
+ result = some_request()
+ for resource in result.iterator():
+ print resource
+
+ #. As a list::
+
+ result = some_request()
+ print result.all()
+
+ #. Also you can request some page manually
+
+ .. autoattribute:: pygithub3.core.result.Result.pages
+ .. automethod:: pygithub3.core.result.Result.get_page
+
+ Each ``Page`` is an iterator and contains resources::
+
+ result = some_request()
+ assert result.pages > 3
+ page3 = result.get_page(3)
+ page3_resources = list(page3)
"""
def __init__(self, client, request, **kwargs):