~josealberto4444/apodnasabot

44dc26bd5daedfa4179075b71fe1ed81fadd18cc — José Alberto Orejuela García 2 years ago cede855
Deal with invalid dates correctly
1 files changed, 6 insertions(+), 2 deletions(-)

M api.py
M api.py => api.py +6 -2
@@ 51,11 51,15 @@ def save_api_response(api_response):
    save_json(filename, api_response)
    save_media(filename, api_response)

date = '2019-08-14'
date = '2029-08-14'

if not os.path.exists('data/' + date + '.json'):
    api_key = read_api_key()
    api_response = ask_api(api_key, date)
    save_api_response(api_response)
    if 'code' in api_response:
        if api_response['code'] == 400:
            print(api_response['msg'])
    else:
        save_api_response(api_response)
else:
    print('It was already downloaded.')