Spaces:
Runtime error
Runtime error
alex n
commited on
Commit
Β·
02fb8b0
1
Parent(s):
ec470e7
fixed
Browse files
app.py
CHANGED
@@ -46,14 +46,14 @@ def get_validator_data() -> pd.DataFrame:
|
|
46 |
# Get Step and Range from endpoints
|
47 |
try:
|
48 |
axon_endpoint = f"http://{validator_info['Axon']}"
|
49 |
-
step_response = requests.get(f"{axon_endpoint}/step", timeout=
|
50 |
step_response.raise_for_status()
|
51 |
validator_info['Step'] = step_response.json()
|
52 |
|
53 |
bits_response = requests.get(
|
54 |
f"{axon_endpoint}/bits",
|
55 |
headers={"range": "bytes=-1"},
|
56 |
-
timeout=
|
57 |
)
|
58 |
bits_response.raise_for_status()
|
59 |
binary_string = ''.join(format(byte, '08b') for byte in bits_response.content)
|
@@ -61,9 +61,11 @@ def get_validator_data() -> pd.DataFrame:
|
|
61 |
validator_info['API'] = '<span class="api-status api-up">β
</span>' if bits_response.ok else '<span class="api-status api-down">β</span>'
|
62 |
|
63 |
except requests.Timeout:
|
64 |
-
|
65 |
except Exception as e:
|
66 |
-
|
|
|
|
|
67 |
|
68 |
try:
|
69 |
last_update = int(metagraph.last_update[uid])
|
|
|
46 |
# Get Step and Range from endpoints
|
47 |
try:
|
48 |
axon_endpoint = f"http://{validator_info['Axon']}"
|
49 |
+
step_response = requests.get(f"{axon_endpoint}/step", timeout=(2, 3))
|
50 |
step_response.raise_for_status()
|
51 |
validator_info['Step'] = step_response.json()
|
52 |
|
53 |
bits_response = requests.get(
|
54 |
f"{axon_endpoint}/bits",
|
55 |
headers={"range": "bytes=-1"},
|
56 |
+
timeout=(2, 3)
|
57 |
)
|
58 |
bits_response.raise_for_status()
|
59 |
binary_string = ''.join(format(byte, '08b') for byte in bits_response.content)
|
|
|
61 |
validator_info['API'] = '<span class="api-status api-up">β
</span>' if bits_response.ok else '<span class="api-status api-down">β</span>'
|
62 |
|
63 |
except requests.Timeout:
|
64 |
+
validator_info['API'] = '<span class="api-status api-down">β</span>'
|
65 |
except Exception as e:
|
66 |
+
if not isinstance(e, requests.Timeout):
|
67 |
+
print(f"Error connecting to {axon_endpoint}: {str(e)}")
|
68 |
+
validator_info['API'] = '<span class="api-status api-down">β</span>'
|
69 |
|
70 |
try:
|
71 |
last_update = int(metagraph.last_update[uid])
|