feat: Add pagination to WaniKani lessons fetcher for assignments
This commit is contained in:
parent
f22d224bc9
commit
ed364ee9a7
|
@ -26,10 +26,12 @@ class WaniKaniLessonsFetcher(Scraper):
|
|||
'Authorization': f'Bearer {secrets.wanikani_api_key()}',
|
||||
'Wanikani-Revision': '20170710',
|
||||
}
|
||||
response = self.session.get(url, headers=headers)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
for assignment in data.get('data', []):
|
||||
data = assignment['data']
|
||||
print(data)
|
||||
yield data
|
||||
while url:
|
||||
response = self.session.get(url, headers=headers)
|
||||
response.raise_for_status()
|
||||
json_resp = response.json()
|
||||
for assignment in json_resp.get('data', []):
|
||||
data_item = assignment['data']
|
||||
print(data_item)
|
||||
yield data_item
|
||||
url = json_resp.get("pages", {}).get("next_url")
|
||||
|
|
Loading…
Reference in New Issue
Block a user