Catch possible exception on electrum server page
This commit is contained in:
parent
ce76fe2992
commit
471b06bc67
|
@ -17,12 +17,15 @@ eelctrs_active = False
|
||||||
def update_electrs_info():
|
def update_electrs_info():
|
||||||
global electrum_server_current_block
|
global electrum_server_current_block
|
||||||
|
|
||||||
raw_data = requests.get("http://localhost:4224")
|
try:
|
||||||
prom_data = text_string_to_metric_families(raw_data.text)
|
raw_data = requests.get("http://localhost:4224")
|
||||||
for family in prom_data:
|
prom_data = text_string_to_metric_families(raw_data.text)
|
||||||
for sample in family.samples:
|
for family in prom_data:
|
||||||
if sample.name == "electrs_index_height":
|
for sample in family.samples:
|
||||||
electrum_server_current_block = int(sample.value)
|
if sample.name == "electrs_index_height":
|
||||||
|
electrum_server_current_block = int(sample.value)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def is_electrs_active():
|
def is_electrs_active():
|
||||||
global eelctrs_active
|
global eelctrs_active
|
||||||
|
|
Loading…
Reference in New Issue
Block a user