mirror of
https://github.com/FAUSheppy/corona-mich-nicht-voll
synced 2025-12-06 11:41:34 +01:00
Initial
This commit is contained in:
20
getdata.py
Executable file
20
getdata.py
Executable 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)
|
||||||
|
|
||||||
Reference in New Issue
Block a user