Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 46 while remaining > 0:$
- 47 LOG.info(f"Position: {from_query}")$
- 48 size = remaining if remaining < batch_size else batch_size$
- 49 request_url = f"{BASE_URL}/associations?size={size}&from={from_query}"$
- 50 req = session.request(url=request_url, method='GET')$
- 51 if req.status_code == 404:$
- 52 raise Exception (f"404, {request_url} not found")$
- 53 hits = req.json()["hits"]["hits"]$
- 54 #print(f"hits={len(hits)}")$
- 55 #with open('hits.json', 'w') as f:$
- 56 # json.dump(hits, f, indent=4)$
- 57 document.append(hits)$
- 58 #break$
- 59 #print(len(hits)[0])$
- 60 retrieved = len(hits)$
- 61 remaining = remaining - retrieved$
- 62 from_query = from_query + retrieved$
- 63 LOG.info(f"Remaining: {remaining}")$
- 64 LOG.info("Finished downloading")$
- 65 return document$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement