Dieu-Sang commited on
Commit
4645e40
·
1 Parent(s): c154ab1

fix edamam api

Browse files
Files changed (1) hide show
  1. api/edamam_api.py +5 -5
api/edamam_api.py CHANGED
@@ -50,14 +50,14 @@ def get_recipes(
50
  if not edamam_app_id or not edamam_app_key:
51
  return []
52
 
53
- protein_grams = round(protein_calories / 4)
54
- carbs_grams = round(carbs_calories / 4)
55
- fat_grams = round(fat_calories / 9)
56
 
57
  params = {
58
  'type': 'any',
59
- 'app_id': my_edamam_app_id,
60
- 'app_key': my_edamam_app_key,
61
  'calories': f"{str(calories - 50)}-{str(calories + 50)}",
62
  'nutrients[PROCNT]': f"{str(protein_grams - 5)}-{str(protein_grams + 5)}",
63
  'nutrients[CHOCDF]': f"{str(carbs_grams - 5)}-{str(carbs_grams + 5)}",
 
50
  if not edamam_app_id or not edamam_app_key:
51
  return []
52
 
53
+ protein_grams = round(int(protein_calories) / 4)
54
+ carbs_grams = round(int(carbs_calories) / 4)
55
+ fat_grams = round(int(fat_calories) / 9)
56
 
57
  params = {
58
  'type': 'any',
59
+ 'app_id': edamam_app_id,
60
+ 'app_key': edamam_app_key,
61
  'calories': f"{str(calories - 50)}-{str(calories + 50)}",
62
  'nutrients[PROCNT]': f"{str(protein_grams - 5)}-{str(protein_grams + 5)}",
63
  'nutrients[CHOCDF]': f"{str(carbs_grams - 5)}-{str(carbs_grams + 5)}",