Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Remi/DailyRecipe.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
93 lines (89 sloc)
4.8 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def DailyRecipe(): | |
import requests | |
import json | |
import datetime | |
current_date = datetime.datetime.today() | |
print("Weekday", current_date.isoweekday()) | |
if current_date.isoweekday() == 1: | |
print("Today is Monday: mac and cheese monday") | |
url = "https://api.spoonacular.com/recipes/270723/analyzedInstructions?apiKey=2c7d213247c34ccea25c72f9fe9053e9" | |
url2 = "https://api.spoonacular.com/recipes/informationBulk?ids=270723&apiKey=cbd2e8ce18e04227b99205001c304bfa" | |
response= requests.get(url2) | |
rsp= response.json() | |
for item in rsp [0]["extendedIngredients"]: | |
print(item["originalString"]) | |
for x in rsp[0]["analyzedInstructions"][0]["steps"]: | |
print(x["number"]) | |
print(x["step"]) | |
######################################################## | |
elif current_date.isoweekday() == 2: | |
print("Today is Tuesday: taco tuesday") | |
url = "https://api.spoonacular.com/recipes/201297/analyzedInstructions?apiKey=2c7d213247c34ccea25c72f9fe9053e9" | |
url2 = "https://api.spoonacular.com/recipes/informationBulk?ids=201297&apiKey=cbd2e8ce18e04227b99205001c304bfa" | |
response= requests.get(url2) | |
rsp= response.json() | |
for item in rsp [0]["extendedIngredients"]: | |
print(item["originalString"]) | |
for x in rsp[0]["analyzedInstructions"][0]["steps"]: | |
print(x["number"]) | |
print(x["step"]) | |
####################################################### | |
elif current_date.isoweekday()==3: | |
print("Today is Wednesday: Wrap wednesday") | |
url = "https://api.spoonacular.com/recipes/266692/analyzedInstructions?apiKey=2c7d213247c34ccea25c72f9fe9053e9" | |
url2 = "https://api.spoonacular.com/recipes/informationBulk?ids=266692&apiKey=cbd2e8ce18e04227b99205001c304bfa" | |
response= requests.get(url2) | |
rsp= response.json() | |
for item in rsp [0]["extendedIngredients"]: | |
print(item["originalString"]) | |
for x in rsp[0]["analyzedInstructions"][0]["steps"]: | |
print(x["number"]) | |
print(x["step"]) | |
###################################################### | |
elif current_date.isoweekday() == 4: | |
print("Today is Thursday: pizza night") | |
url = "https://api.spoonacular.com/recipes/249348/analyzedInstructions?apiKey=2c7d213247c34ccea25c72f9fe9053e9" | |
url2 = "https://api.spoonacular.com/recipes/informationBulk?ids=249348&apiKey=cbd2e8ce18e04227b99205001c304bfa" | |
response= requests.get(url2) | |
rsp= response.json() | |
for item in rsp [0]["extendedIngredients"]: | |
print(item["originalString"]) | |
for x in rsp[0]["analyzedInstructions"][0]["steps"]: | |
print(x["number"]) | |
print(x["step"]) | |
####################################################### | |
elif current_date.isoweekday() == 5: | |
print("Today is Friday: Fishy Friday") | |
url = "https://api.spoonacular.com/recipes/275852/analyzedInstructions?apiKey=2c7d213247c34ccea25c72f9fe9053e9" | |
url2 = "https://api.spoonacular.com/recipes/informationBulk?ids=275852&apiKey=cbd2e8ce18e04227b99205001c304bfa" | |
response= requests.get(url2) | |
rsp= response.json() | |
for item in rsp [0]["extendedIngredients"]: | |
print(item["originalString"]) | |
for x in rsp[0]["analyzedInstructions"][0]["steps"]: | |
print(x["number"]) | |
print(x["step"]) | |
######################################################## | |
elif current_date.isoweekday() == 6: | |
print("Today is Saturday: Curry night") | |
url = "https://api.spoonacular.com/recipes/660290/analyzedInstructions?apiKey=2c7d213247c34ccea25c72f9fe9053e9" | |
url2 = "https://api.spoonacular.com/recipes/informationBulk?ids=660290&apiKey=cbd2e8ce18e04227b99205001c304bfa" | |
response= requests.get(url2) | |
rsp= response.json() | |
for item in rsp [0]["extendedIngredients"]: | |
print(item["originalString"]) | |
for x in rsp[0]["analyzedInstructions"][0]["steps"]: | |
print(x["number"]) | |
print(x["step"]) | |
########################################################### | |
elif current_date.isoweekday() == 7: | |
print("Today is Sunday: Pie Day") | |
url = "https://api.spoonacular.com/recipes/200430/analyzedInstructions?apiKey=2c7d213247c34ccea25c72f9fe9053e9" | |
url2 = "https://api.spoonacular.com/recipes/informationBulk?ids=200430&apiKey=cbd2e8ce18e04227b99205001c304bfa" | |
response= requests.get(url2) | |
rsp= response.json() | |
for item in rsp [0]["extendedIngredients"]: | |
print(item["originalString"]) | |
for x in rsp[0]["analyzedInstructions"][0]["steps"]: | |
print(x["number"]) | |
print(x["step"]) |