Skip to content

Commit

Permalink
Update grocery.py
Browse files Browse the repository at this point in the history
Fixed bug for recipes with no comments
  • Loading branch information
KatieZZY authored Aug 12, 2020
1 parent d21a288 commit 40a59d8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion grocery.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def ingredient_parser(url_text):
name = list(ingredients['name'])
amount = [i['measure']['amount'] for i in data['ingredients']]
unit = [i['measure']['name'] for i in data['ingredients']]
comment = list(ingredients['comment'])
if 'comment' in ingredients.keys():
comment = list(ingredients['comment'])
else:
comment = [' ' for i in data['ingredients']]
recipe = [data['title'] for i in range(len(data['ingredients']))]

# convert to metric
Expand Down

0 comments on commit 40a59d8

Please sign in to comment.