-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Useful for fetching large sets of results
Example code using requests library
api.fetch(query, {count: count})
try:
with requests.get(url, stream=True) as r:
r.raise_for_status()
with open(output_file, "wb") as f:
for chunk in r.iter_content(chunk_size=8192):
if chunk: # filter out keep-alive chunks
f.write(chunk)
except requests.exceptions.HTTPError as e:
print(f"HTTP error {r.status_code} while downloading {url}")
except requests.exceptions.RequestException as e:
print(f"Request failed for {url}")
Metadata
Metadata
Assignees
Labels
No labels