~josealberto4444/apodnasabot

cede8559cf4c9e2812669d06ea9dfee00112874c — José Alberto Orejuela García 2 years ago 2ae28dc
Ask API only if not downloaded
1 files changed, 8 insertions(+), 4 deletions(-)

M api.py
M api.py => api.py +8 -4
@@ 14,6 14,7 @@
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import configparser
import os.path
import requests
import youtube_dl



@@ 50,8 51,11 @@ def save_api_response(api_response):
    save_json(filename, api_response)
    save_media(filename, api_response)

date = '2019-07-10'
date = '2019-08-14'

api_key = read_api_key()
api_response = ask_api(api_key, date)
save_api_response(api_response)
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)
else:
    print('It was already downloaded.')