mirror of
https://github.com/r4sas/Niflheim-api
synced 2025-01-30 16:44:30 +00:00
30d nodes, update template
This commit is contained in:
parent
a37f5b0ec4
commit
87f5936e83
@ -93,6 +93,25 @@ class nodes24h(Resource):
|
||||
|
||||
return nodeinfo
|
||||
|
||||
|
||||
# alive nodes count for latest 30 days
|
||||
class nodes30d(Resource):
|
||||
def get(self):
|
||||
cur = dbconn.cursor()
|
||||
nodes = {}
|
||||
cur.execute("SELECT * FROM timeseries ORDER BY unixtstamp DESC LIMIT 24 * 30")
|
||||
for i in cur.fetchall():
|
||||
nodes[i[1]] = i[0]
|
||||
|
||||
dbconn.commit()
|
||||
cur.close()
|
||||
|
||||
nodeinfo = {}
|
||||
nodeinfo['nodes30d'] = nodes
|
||||
|
||||
return nodeinfo
|
||||
|
||||
|
||||
# alive nodes count for latest 24 hours
|
||||
class crawlResult(Resource):
|
||||
def get(self):
|
||||
@ -122,6 +141,7 @@ def fpage():
|
||||
api.add_resource(nodesCurrent, '/current')
|
||||
api.add_resource(nodesInfo, '/nodeinfo')
|
||||
api.add_resource(nodes24h, '/nodes24h')
|
||||
api.add_resource(nodes30d, '/nodes30d')
|
||||
api.add_resource(crawlResult, '/result.json')
|
||||
|
||||
# regirster signal handler
|
||||
|
@ -34,11 +34,17 @@
|
||||
<div class="apireq">
|
||||
http://[31a:fb8a:c43e:ca59::2]/nodes24h <sup><a href="http://[31a:fb8a:c43e:ca59::2]/nodes24h" target="_blank">[⇗]</a> <a href="http://nodelist.ygg/nodes24h" target="_blank">[DNS]</a></sup>
|
||||
</div>
|
||||
Active nodes count for last 30 days:<br />
|
||||
<div class="apireq">
|
||||
http://[31a:fb8a:c43e:ca59::2]/nodes30d <sup><a href="http://[31a:fb8a:c43e:ca59::2]/nodes30d" target="_blank">[⇗]</a> <a href="http://nodelist.ygg/nodes30d" target="_blank">[DNS]</a></sup>
|
||||
</div>
|
||||
|
||||
<div class="wide"></div>
|
||||
<strong>Get latest crawler data</strong><br />
|
||||
You can download data in raw json provided by <a href="https://github.com/neilalexander/yggcrawl" target="_blank">yggcrawl</a>: result.json <sup><a href="http://[31a:fb8a:c43e:ca59::2]/result.json" target="_blank">[⇗]</a> <a href="http://nodelist.ygg/result.json" target="_blank">[DNS]</a></sup>
|
||||
<br /><br />
|
||||
You can download data in raw json provided by <a href="https://github.com/neilalexander/yggcrawl" target="_blank">yggcrawl</a>:<br />
|
||||
<div class="apireq">
|
||||
http://[31a:fb8a:c43e:ca59::2]/result.json <sup><a href="http://[31a:fb8a:c43e:ca59::2]/result.json" target="_blank">[⇗]</a> <a href="http://nodelist.ygg/result.json" target="_blank">[DNS]</a></sup>
|
||||
</div>
|
||||
|
||||
<div class="wide"></div>
|
||||
<small>Made with <a href="https://github.com/r4sas/Niflheim-api" target="_blank">fork</a> of <a href="https://github.com/yakamok/Niflheim-api" target="_blank">Niflheim-API</a> by yakamok</small>
|
||||
|
Loading…
x
Reference in New Issue
Block a user