Skip to content

Commit

Permalink
some more documentation about iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
odrling committed Jun 28, 2017
1 parent 3029d6d commit c736ccb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
6 changes: 6 additions & 0 deletions docs/usage/iterators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,9 @@ An iterator for endpoints using the ``since_id`` parameter
.. code-block:: python
responses = request.iterator.with_since_id(fill_gaps=True)
.. note::
Both :func:`~peony.iterators.with_since_id` and
:func:`~peony.iterators.with_max_id` have a ``force`` parameter that can
be used in case you need to keep making requests after a request returned
no content. Set ``force`` to ``True`` if this is the case.
28 changes: 9 additions & 19 deletions peony/iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ class AbstractIterator(ABC):
Parameters
----------
_request : .requests.Request
request : .requests.Request
Main request
**kwargs : dict
Parameters of the request
"""

def __init__(self, request):
Expand All @@ -35,14 +33,12 @@ class IdIterator(AbstractIterator):
Parameters
----------
_request : .requests.Request
request : .requests.Request
Main request
_parameter : str
parameter : str
Parameter to change for each request
_force : bool
force : bool
Keep the iterator after empty responses
kwargs : dict
Request parameters
"""

def __init__(self, request, parameter, force=False):
Expand Down Expand Up @@ -73,10 +69,8 @@ class MaxIdIterator(IdIterator):
Parameters
----------
_request : .requests.Request
request : .requests.Request
Main request
kwargs : dict
Parameters of the request
"""

def __init__(self, request):
Expand All @@ -98,14 +92,12 @@ class SinceIdIterator(IdIterator):
Parameters
----------
_request : .requests.Request
request : .requests.Request
Main request
_force : bool
force : bool
Keep the iterator after empty responses
_fill_gaps : bool
fill_gaps : bool
Fill the gaps (if there are more than ``count`` tweets to get)
**kwargs : dict
Parameters of the request
"""

def __init__(self, request, force=True, fill_gaps=False):
Expand Down Expand Up @@ -162,10 +154,8 @@ class CursorIterator(AbstractIterator):
Parameters
----------
_request : .requests.Request
request : .requests.Request
Main request
**kwargs : dict
Parameters of the request
"""

async def __anext__(self):
Expand Down

0 comments on commit c736ccb

Please sign in to comment.