fix filepaths

This commit is contained in:
Ben Harris 2019-03-16 14:59:02 -04:00
parent a4242090b0
commit c2fc0237fe
Signed by untrusted user: ben
GPG Key ID: 4E0AF802FFF7960C
1 changed files with 3 additions and 2 deletions

View File

@ -2,13 +2,14 @@
import requests, json
import xml.etree.ElementTree as xml
WORK_DIR = "/var/www/tilde.chat"
r = requests.get("http://localhost:8081/stats")
r.raise_for_status()
out = {}
d = xml.fromstring(r.text)
assert d.tag == "inspircdstats"
with open("blacklist", "r") as f:
with open(f"{WORK_DIR}/blacklist", "r") as f:
BLACKLIST = f.read().splitlines()
def define(name, xps, vfilter=lambda x: x):
@ -49,5 +50,5 @@ channels.sort(key=lambda x: x["name"].lower())
out["channels"] = channels
# print([x.text for x in d.findall("./channellist/channel/channeltopic/topictext")])
with open("/var/www/tilde.chat/stats.json", "w") as f:
with open(f"{WORK_DIR}/stats.json", "w") as f:
json.dump(out, f)