This commit is contained in:
Yannik Schmidt
2021-05-23 01:54:59 +02:00
commit 52f86a367f

20
getdata.py Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/python3
import requests
import argparse
from bs4 import BeautifulSoup
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('URL', help='URL to query')
args = parser.parse_args()
response = requests.get(args.URL)
b = BeautifulSoup(response.content.decode("UTF-8"))
el = b.find(id="visitorcount-container")
count = el.get("data-value")
postr = requests.post('http://localhost:8086/write?db=collectd',
data="bouldern,ident=zirndorf {}".format(count))
print(postr.status)
sys.exit(0)