API client: fix date input

This commit is contained in:
Théophile Bastian 2017-10-16 19:47:17 +02:00
parent 6892b04742
commit fcdbf515e9

View file

@ -1,3 +1,5 @@
#!/usr/bin/env python3
''' API client for bocal-site ''' ''' API client for bocal-site '''
import json import json
@ -91,7 +93,11 @@ def cmd(func):
@cmd @cmd
def cmd_publish(token, args): def cmd_publish(token, args):
publish_date = date.today() if not args.date else args.date if not args.date:
publish_date = date.today()
else:
year, month, day = [int(x) for x in args.date.strip().split('-')]
publish_date = date(year=year, month=month, day=day)
(ret_code, ret_str) = publish(args.host, (ret_code, ret_str) = publish(args.host,
token, token,
args.numero, args.numero,