Skip to content

Commit c3f8e00

Browse files
author
hackermd
committed
Update usage example in documentation
1 parent ffc7f4e commit c3f8e00

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

docs/usage.rst

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,15 @@ In this case, the method can be called repeatedly to request remaining results u
9797

9898
.. code-block:: python
9999
100-
studies = client.search_for_studies()
101-
batch_size = len(studies)
102-
count = 1
100+
studies = []
101+
offset = 0
103102
while True:
104-
offset = batch_size * count
105-
try:
106-
subset = client.search_for_studies(offset=offset)
107-
except requests.exceptions.HTTPError:
103+
subset = client.search_for_studies(offset=offset)
104+
if len(subset) == 0:
108105
break
109106
studies.extend(subset)
110-
count += 1
107+
offset += len(subset)
108+
111109
112110
.. _searchforseries:
113111

0 commit comments

Comments
 (0)