removed walrus from gasnow_file variable

This commit is contained in:
Alexander 2024-07-15 11:10:17 -04:00
parent 7c364d56a8
commit d67e67d166

View file

@ -379,8 +379,9 @@ def get_beacon_gas_prices(speed=None, cache_interval_seconds=10):
speeds = ('rapid', 'fast', 'standard', 'slow',)
os.makedirs(cache_folder := './data/cache/', exist_ok=True)
gas = {}
gasnow_file = "{}/gasnow.json".format(cache_folder)
try:
gas = json.load(open(gasnow_file := "{}/gasnow.json".format(cache_folder)))
gas = json.load(open(gasnow_file))
except (JSONDecodeError, FileNotFoundError):
pass
if not gas or not gas['data'] or (gas['data']['timestamp'] / 1000) + cache_interval_seconds < time.time():