Looking to get current timestamp in python service but I am unable to use these libraries because they are not in hosted.py:
from datetime import datetime
import date
Is there any way to do this? I tried os.system('%m-%d-%Y')
, but it gave me some random number which wasn’t the current date.
I see two ways to do this but in my opinion they are not the best ways:
- Set a static option for date in node.json and update it every day
- Call an external API that will return the current timestamp when it hits the server (ill probably end up doing this if I don’t have any other options and thats fine)
Edit: I see from datetime
is used here https://github.com/info-beamer/package-scheduled-player/blob/f8cbd30a94ad64630cf9fcff1b8d03350aac734f/service, maybe im doing something wrong. Back to testing I go
Edit2: got it working
from datetime import datetime
DOES work on Infobeamer hosted