mirror of
https://github.com/FAUSheppy/corona-mich-nicht-voll
synced 2025-12-06 03:31:35 +01:00
fixes
This commit is contained in:
12
getdata.py
12
getdata.py
@@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
import requests
|
import requests
|
||||||
import argparse
|
import argparse
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
@@ -7,14 +9,18 @@ from bs4 import BeautifulSoup
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('URL', help='URL to query')
|
parser.add_argument('URL', help='URL to query')
|
||||||
|
parser.add_argument('LOCATION', help='URL to query')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
response = requests.get(args.URL)
|
response = requests.get(args.URL)
|
||||||
b = BeautifulSoup(response.content.decode("UTF-8"))
|
b = BeautifulSoup(response.content.decode("UTF-8"), "html.parser")
|
||||||
el = b.find(id="visitorcount-container")
|
el = b.find(id="visitorcount-container")
|
||||||
count = el.get("data-value")
|
count = el.get("data-value")
|
||||||
|
#os.system("curl http://localhost:8086/write?db=collectd \
|
||||||
|
# -XPOST --data-binary 'bouldern,ident=zirndorf value={}'".format(count))
|
||||||
postr = requests.post('http://localhost:8086/write?db=collectd',
|
postr = requests.post('http://localhost:8086/write?db=collectd',
|
||||||
data="bouldern,ident=zirndorf {}".format(count))
|
data="bouldern,ident={} value={}".format(args.LOCATION, count),
|
||||||
print(postr.status)
|
headers={'Content-Type': 'application/octet-stream'})
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user