Skip to content

Instantly share code, notes, and snippets.

@neroist
Last active February 17, 2022 13:09
Show Gist options
  • Select an option

  • Save neroist/cb71f07fa17430d0751b949dc91ea569 to your computer and use it in GitHub Desktop.

Select an option

Save neroist/cb71f07fa17430d0751b949dc91ea569 to your computer and use it in GitHub Desktop.
BreakFast API Console Application - Written in Python
"""
A console application for finding breakfast recipes using the BreakFast API.
"""
import requests
response = requests.get('https://breakfastapi.fun/').json()
name = response['Recipe Name']
time = response['Cook Time (Minutes)']
ingredients = response['Ingredients']
directions = response['Directions'].split('.')
del directions[directions.index('')]
print('Recipe Name:', name, '\n')
print('Cook Time:', time, f'({time / 60} hours)', '\n')
print('Ingredients:')
for i in eval(ingredients.replace("'", '"')):
print(f' - {i}')
print('\nDirections: ')
for i in directions:
print(f'{directions.index(i) + 1}. {i.strip()}')
@neroist
Copy link
Copy Markdown
Author

neroist commented Feb 17, 2022

Updated due to update in the BreakFast API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment