diff --git a/demo/post_webhook.py b/demo/post_webhook.py new file mode 100644 index 0000000..a61cc92 --- /dev/null +++ b/demo/post_webhook.py @@ -0,0 +1,21 @@ +import json +import requests +import time + +address = "localhost/foo" + +while True: + t = random.uniform(100, 10000) + body = {'VM Create time': '{}'.format(t), + 'units': 'ms'} + headers = {'content-type': 'application/json'} + + try: + requests.post(url=address, + data=json.dumps(body), + headers=headers, + timeout="10") + except Exception: + print("unable to post") + + time.sleep(random.randint(5, 20))