Update random sleep duration in main functionality for API rate limiting
This commit is contained in:
3
main.py
3
main.py
@@ -62,8 +62,7 @@ async def main():
|
|||||||
logger.error("Failed to parse tweet JSON")
|
logger.error("Failed to parse tweet JSON")
|
||||||
|
|
||||||
|
|
||||||
await asyncio.sleep(random.uniform(11, 23)) # random delay between 7 and 15 seconds
|
await asyncio.sleep(random.uniform(17, 31))
|
||||||
|
|
||||||
atexit.register(lambda: write_json(OUTPUT_FILE, {"tweets": _results}))
|
atexit.register(lambda: write_json(OUTPUT_FILE, {"tweets": _results}))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user