2018-11-21 18:21:25 +01:00
# niflheim-api.py
2018-11-17 18:40:30 +01:00
2018-11-21 18:27:06 +01:00
Niflheim-api provides both a web interface and an api. The web interface is used to see some basic stats on the data vserv.py has collected and the API provides raw data in JSON format.
2018-11-17 18:40:30 +01:00
2018-11-21 18:21:25 +01:00
## Install & Setup
2018-11-21 20:09:00 +01:00
__python dependancies:__
flask
flask_restful
psycopg2
2018-11-21 20:09:20 +01:00
2018-11-21 18:24:01 +01:00
Configure niflheim-api.py to use the Postgres databse you setup for vserv.py.
2018-11-21 18:21:25 +01:00
2018-11-21 18:24:01 +01:00
__So open niflheim-api.py:__
2018-11-21 18:21:25 +01:00
DB_PASSWORD = "password"
DB_USER = "yggindex"
DB_NAME = "yggindex"
DB_HOST = "localhost"
Make sure the above matches what you have in vserv.py.
The API will startup on port 3000 and accept all ipv6 connections if you want to change this edit the last line:
app.run(host='::', port=3000)
2018-11-21 18:27:06 +01:00
2018-11-21 18:27:27 +01:00
__Accessing the API data:__
2018-11-21 18:27:06 +01:00
http://exmaple.com:3000/current
2018-11-21 19:03:09 +01:00
Add yggapi.services to systemd.