From d542ec63694d71c9b618e89779e8e02d792743ae Mon Sep 17 00:00:00 2001 From: connorsanders Date: Tue, 12 Dec 2023 23:16:51 -0600 Subject: [PATCH 1/3] Refactored session management system to handle cookie and crumbs better. Added fixes for #167, #166, #160. --- yahoofinancials/cache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yahoofinancials/cache.py b/yahoofinancials/cache.py index 135a5ea..5623356 100644 --- a/yahoofinancials/cache.py +++ b/yahoofinancials/cache.py @@ -1,6 +1,6 @@ import logging import time - +import random import peewee as _peewee from threading import Lock import os as _os @@ -356,7 +356,7 @@ def initialise(self): self.initialised = 1 # success return except _peewee.OperationalError: - time.sleep(10) + time.sleep(random.randint(3, 10)) continue From ac3e22ca91bca8d371b75b631fea3757ba3e7449 Mon Sep 17 00:00:00 2001 From: connorsanders Date: Tue, 12 Dec 2023 23:19:01 -0600 Subject: [PATCH 2/3] Refactored session management system to handle cookie and crumbs better. Added fixes for #167, #166, #160. --- yahoofinancials/cache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yahoofinancials/cache.py b/yahoofinancials/cache.py index 5623356..9d99f2e 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 < 100: + while i < 150: 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, 10)) + time.sleep(random.randint(3, 15)) continue From 7107eefaa6050301ed5c8920070dd11f23abc199 Mon Sep 17 00:00:00 2001 From: connorsanders Date: Tue, 12 Dec 2023 23:26:10 -0600 Subject: [PATCH 3/3] Refactored session management system to handle cookie and crumbs better. Added fixes for #167, #166, #160. --- yahoofinancials/cache.py | 1 + 1 file changed, 1 insertion(+) diff --git a/yahoofinancials/cache.py b/yahoofinancials/cache.py index 9d99f2e..4d25542 100644 --- a/yahoofinancials/cache.py +++ b/yahoofinancials/cache.py @@ -358,6 +358,7 @@ def initialise(self): except _peewee.OperationalError: time.sleep(random.randint(3, 15)) continue + self.initialised = 0 # failure def lookup(self, strategy):