Add online time and deaths to player card #3

Merged
erik merged 4 commits from lundberg_onlinetime_deaths into master 2025-05-02 19:36:25 +00:00
3 changed files with 47 additions and 0 deletions
Showing only changes of commit a00cfb688c - Show all commits

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
.venv
__pycache__

0
__init__.py Normal file
View file

45
generate_data.py Normal file
View file

@ -0,0 +1,45 @@
import httpx
from datetime import datetime, timedelta, timezone
from time import sleep
from main import TelemetrySnapshot
def main() -> None:
wait = 10
online_time = -10
ew = 0
ns = 0
while True:
snapshot = TelemetrySnapshot(
character_name="Test name",
char_tag="test_tag",
session_id="test_session_id",
timestamp=datetime.now(tz=timezone.utc),
ew=ew,
ns=ns,
z=0,
kills=0,
kills_per_hour="kph_str",
onlinetime=str(timedelta(seconds=online_time)),
deaths=0,
rares_found=0,
prismatic_taper_count=0,
vt_state="test state",
)
resp = httpx.post(
"http://localhost:8000/position/",
data=snapshot.model_dump_json(),
headers={
"Content-Type": "application/json",
"X-PLUGIN-SECRET": "your_shared_secret",
},
)
print(resp)
sleep(wait)
ew += 0.1
ns += 0.1
online_time += wait
if __name__ == "__main__":
main()