Skip to content

Commit b481814

Browse files
committed
Support starting_after and ending_before params
1 parent 41c16a0 commit b481814

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clever/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -710,20 +710,21 @@ def all(cls, auth=None, **params):
710710

711711
@classmethod
712712
def iter(cls, auth=None, **params):
713-
for unsupported_param in ['limit', 'page', 'starting_after', 'ending_before']:
713+
for unsupported_param in ['limit', 'page']:
714714
if unsupported_param in params:
715715
raise CleverError("ListableAPIResource does not support '%s' parameter" %
716716
(unsupported_param,))
717717

718718
requestor = APIRequestor(auth)
719719
url = cls.class_url()
720-
params['limit'] = cls.ITER_LIMIT
720+
params['limit'] = cls.ITER_LIMIT
721721

722722
while url:
723723
response, auth = requestor.request('get', url, params)
724724
for datum in convert_to_clever_object(cls, response, auth):
725725
yield datum
726-
url = get_link(response, 'next')
726+
727+
url = get_link(response, 'prev' if 'ending_before' in params else 'next')
727728
# params already included in url from get_link
728729
params = {}
729730

0 commit comments

Comments
 (0)