def get_api(date): api = {"favorites": favorites, "news" : api_calls.get_news(date), "apod" : api_calls.get_nasa_apod(date), "nasa-news": api_calls.get_nasa_news(date) # add more if necessary } return api
def apod(date): apodJson = api_calls.get_nasa_apod(date) if "400, bad request" in apodJson: return jsonify(apodJson) url = apodJson["url"] if "hdurl" in apodJson: url = apodJson["hdurl"] return render_template("apod.html", url=url)
def apod(date): # View the Astronomy Picture of the Day: "YYYY-mm-dd" apodJson = api_calls.get_nasa_apod(date) if "400, bad request" in apodJson: return jsonify(apodJson) url = apodJson["url"] if "hdurl" in apodJson: url = apodJson["hdurl"] return render_template("apod.html", url=url)
def apod_today(): apodJson = api_calls.get_nasa_apod(utils.getTodayString()) if "hdurl" in apodJson: url = apodJson["hdurl"] return render_template("apod.html", url=apodJson["url"])
def api_apod_today(): return jsonify(api_calls.get_nasa_apod(utils.getTodayString()))
def api_apod(date): return jsonify(api_calls.get_nasa_apod(date))
def api_apod(date): # return the api of date return jsonify(api_calls.get_nasa_apod(date))
def get_api(date): api = {"favorites": favorites} api["news"] = api_calls.get_news(date) api["apod"] = api_calls.get_nasa_apod(date) # add more if necessary return api