Skip to content

Commit 611a73f

Browse files
author
archiegugol
committed
Fixed duplicate calls issue for non-project URLs. Added a break if "Link" is not in header.
1 parent d23e685 commit 611a73f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ghorgs/wrappers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,24 +137,24 @@ def get_paged_content(self, session: requests.Session, url: str) -> list:
137137
print('Hit Rate Limit, will retry after: {}s'.format(retry_after_raw))
138138
sleep(int(retry_after_raw))
139139
continue
140-
response.raise_for_status()
141140

141+
response.raise_for_status()
142142
data = response.json()
143143
assert isinstance(data, list)
144144
all_data.extend(data)
145-
146-
# Need to move this check here and change to 'while True' so the last page of the gitbub project will be processed
145+
# Need to move this check here to process the last page returned by a multiple page result
147146
if current_url == last_url:
148147
break
149148

150149
# check header
151150
if 'Link' in response.headers:
152-
# parse
151+
# This occurs only for multi-page result and on project URL only
153152
parsed_link_header = parse_github_link_header(response.headers['Link'])
154153
current_url = parsed_link_header['next']
155154
last_url = parsed_link_header['last']
156155
else:
157-
last_url = current_url
156+
break
157+
158158
return all_data
159159

160160

0 commit comments

Comments
 (0)