Skip to content

Commit

Permalink
add -id function
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorsantanna2 committed Dec 13, 2023
1 parent 3e6e9ef commit 46c946e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions handler/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def mixnode(nodeid):
info = urlopen("https://explorer.nymtech.net/api/v1/mix-node/"+ nodeid)
bs = json.loads(str(BeautifulSoup(info, 'html.parser')))
res = getInfo(bs)
print(res)
return res


Expand Down
7 changes: 4 additions & 3 deletions telegram/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ def list_nodes(message):
temp = res.json()
text = text + temp.get("title") + "\n" + "Avg Score: " + temp.get("avg_uptime") + "\nRouting Score: " + temp.get("node_performance") + "%\nTotal Stake: " + temp.get("total_stake")[:6] + "\nLocation: " + temp.get("location") + "\n" + "----------------------------------\n"
i = i + 1
elif (message.text[7:10] == '-id']:
elif (message.text[7:10] == '-id'):
try:
res = requests.get("https://localhost:5000/mixnodes/" + message.text[11:]).json()
text = text + "Avg Score: " + temp.get("avg_uptime") + "\nRouting Score: " + temp.get("node_performance") + "%\nTotal Stake: " + temp.get("total_stake") + "\nLocation: " + temp.get("location")
res = requests.get("http://localhost:5000/mixnodes/" + message.text[11:])
temp = res.json()
text = "Avg Score: " + temp.get("avg_uptime") + "\nRouting Score: " + temp.get("node_performance") + "%\nTotal Stake: " + temp.get("total_stake") + "\nLocation: " + temp.get("location")
except:
text = "invalid id"
else:
Expand Down

0 comments on commit 46c946e

Please sign in to comment.