From b5459b208322ec060b50868b513c95973b379d30 Mon Sep 17 00:00:00 2001 From: bjosun <60923795+bjosun@users.noreply.github.com> Date: Fri, 15 Dec 2023 09:20:52 +0100 Subject: [PATCH] Update cache.py Had a problem with getting key_statisitic_data from yahoo finance. Trying out different settings in the while loop and made a bigger span for the random.randint function that worked. --- yahoofinancials/cache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yahoofinancials/cache.py b/yahoofinancials/cache.py index 4d25542..8219083 100644 --- a/yahoofinancials/cache.py +++ b/yahoofinancials/cache.py @@ -348,7 +348,7 @@ def initialise(self): self.initialised = 0 # failure return i = 0 - while i < 150: + while i < 250: try: db.connect() Cookie_db_proxy.initialize(db) @@ -356,7 +356,7 @@ def initialise(self): self.initialised = 1 # success return except _peewee.OperationalError: - time.sleep(random.randint(3, 15)) + time.sleep(random.randint(3, 25)) continue self.initialised = 0 # failure