mirror of
https://github.com/FAUSheppy/skillbird
synced 2025-12-06 06:51:34 +01:00
add import for single events
This commit is contained in:
29
helper_scripts/import_events.py
Executable file
29
helper_scripts/import_events.py
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import datetime as dt
|
||||||
|
|
||||||
|
if not len(sys.argv)>1:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
count = 31000
|
||||||
|
i = 0
|
||||||
|
start = dt.datetime.now()
|
||||||
|
url = "http://127.0.0.1:5000/single-event?session=0000"
|
||||||
|
|
||||||
|
with open(sys.argv[1], "r") as f:
|
||||||
|
for l in f:
|
||||||
|
requests.post(url, json=json.loads(l))
|
||||||
|
cur = dt.datetime.now()
|
||||||
|
i+=1
|
||||||
|
|
||||||
|
percent = int(i/count*100);
|
||||||
|
elapsed = str(cur-start)
|
||||||
|
estRem = str((cur-start)/i*count)
|
||||||
|
if "." in estRem:
|
||||||
|
estRem = estRem.split(".")[0]
|
||||||
|
if "." in elapsed:
|
||||||
|
elapsed = elapsed.split(".")[0]
|
||||||
|
print("Round: {} ({}%) - elapsed: {}, estimated remaining: {}".format(i, percent, elapsed, estRem))
|
||||||
Reference in New Issue
Block a user