Skip to content

Commit

Permalink
Actually honor delay between requests for FreeSound.org dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnVinyard committed Jan 25, 2019
1 parent dc2c763 commit 4aafc9f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zounds/datasets/freesound.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def _iter_results(self, link=None):
'query': self.query,
'token': self.api_key
})
time.sleep(self.delay)

results.raise_for_status()
results = results.json()
Expand All @@ -91,7 +92,7 @@ def _iter_results(self, link=None):
yield self._get_metadata_by_id(r['id'])

# prevent 429 "Too Many Requests" responses
time.sleep(0.2)
time.sleep(self.delay)

for r in self._iter_results(results['next']):
yield r
Expand Down

0 comments on commit 4aafc9f

Please sign in to comment.