pyvas
pyvas copied to clipboard
create schedule: format first_time
Hello,
I'm trying to create a new schedule using the following syntax:
first_time = datetime.now() + timedelta(hours=random.randrange(1, 23, 1), days=1)
with Client('X.X.X.X', username='XXXXXX, password='XXXXXXXXXX') as cli:
r = cli.create_schedule(name,
first_time=first_time.strftime("%Y-%m-%dT%H:%M:%S+02:00"),
duration=1,
duration_unit='day',
period=1,
period_unit='day',
timezone='Europe/Rome')
r.ok
but it seems to use the current time.
>>> with Client('X.X.X.X', username='XXXXXX', password='XXXXXXXXx') as cli:
... r = cli.list_schedules()
... r.ok
...
True
>>> print(r.data)
[{'timezone': 'Europe/Rome', 'comment': None, 'first_time': '2019-05-13T13:23:00+02:00', 'duration': '86400', 'period': '86400', 'simple_duration': {'unit': 'day', '#text': '1'}, 'period_months': '0', 'timezone_abbrev': 'CEST', 'owner': {'name': 'admin'}, 'permissions': {'permission': {'name': 'Everything'}}, 'in_use': '1', '@id': '662769bf-549b-49bb-9036-b61fa6156a65', 'writable': '1', 'simple_period': {'unit': 'day', '#text': '1'}, 'name': 'cnaf_192.135.24.10', 'modification_time': '2019-05-13T11:23:19Z', 'next_time': '2019-05-14T13:23:00+02:00', 'creation_time': '2019-05-13T11:23:19Z', 'user_tags': {'count': '0'}}]
>>>
which format should I use in order to define the right first_time parameter
thanks