diff --git a/tconnectsync/sync/tandemsource/heroku_helpers.py b/tconnectsync/sync/tandemsource/heroku_helpers.py new file mode 100644 index 0000000..4261d6f --- /dev/null +++ b/tconnectsync/sync/tandemsource/heroku_helpers.py @@ -0,0 +1,17 @@ +from ...features import DEFAULT_FEATURES +from .choose_device import TandemSourceChooseDevice +from .process import ProcessTimeRange +from ... import secret + +import datetime + +def run_oneshot(tconnect, nightscout, pretend=False, features=DEFAULT_FEATURES, secret_arg=None, time_start=None, time_end=None): + if not time_start and not time_end: + time_end = datetime.datetime.now() + time_start = time_end - datetime.timedelta(days=1) + + if not secret_arg: + secret_arg = secret + + tconnectDevice = TandemSourceChooseDevice(secret_arg, tconnect).choose() + return ProcessTimeRange(tconnect, nightscout, tconnectDevice, pretend, features).process(time_start, time_end) \ No newline at end of file