hamster-tools/scripts/apitest.py

26 lines
530 B
Python
Raw Normal View History

2023-11-01 19:32:00 +00:00
import os
import sys
2023-11-01 19:33:30 +00:00
2023-11-01 19:32:00 +00:00
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from datetime import datetime, timedelta
2023-11-01 19:39:10 +00:00
from hamstertools.kimai import KimaiAPI, Timesheet, Project, Activity
2023-11-01 19:32:00 +00:00
api = KimaiAPI()
# print(Timesheet.list(api))
2023-11-01 19:33:30 +00:00
t = Timesheet(
api,
2023-11-01 19:32:00 +00:00
activity=Activity.get_by_id(api, 613),
project=Project.get_by_id(api, 233),
begin=datetime.now() - timedelta(minutes=10),
end=datetime.now(),
)
# r = t.upload()
# from pdb import set_trace; set_trace()
print(Timesheet.get_by_id(api, 30683))