Skip to content

Commit

Permalink
Refactored session management system to handle cookie and crumbs better.
Browse files Browse the repository at this point in the history
Added fixes for #167, #166, #160.
  • Loading branch information
connorsanders committed Dec 13, 2023
1 parent 8f1c9ea commit 226620d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions yahoofinancials/cache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import logging
import time

import peewee as _peewee
from threading import Lock
import os as _os
Expand Down Expand Up @@ -345,10 +347,18 @@ def initialise(self):
if db is None:
self.initialised = 0 # failure
return
db.connect()
Cookie_db_proxy.initialize(db)
db.create_tables([_CookieSchema])
self.initialised = 1 # success
i = 0
while i < 100:
try:
db.connect()
Cookie_db_proxy.initialize(db)
db.create_tables([_CookieSchema])
self.initialised = 1 # success
return
except _peewee.OperationalError:
time.sleep(10)
continue


def lookup(self, strategy):
if self.dummy:
Expand Down

0 comments on commit 226620d

Please sign in to comment.