Skip to content

Instantly share code, notes, and snippets.

@angelabauer
Created October 21, 2020 10:34
Show Gist options
  • Save angelabauer/dd71d7072626afd728e1730584c6e4b8 to your computer and use it in GitHub Desktop.
Save angelabauer/dd71d7072626afd728e1730584c6e4b8 to your computer and use it in GitHub Desktop.
import requests
GENDER = YOUR GENDER
WEIGHT_KG = YOUR WEIGHT
HEIGHT_CM = YOUR HEIGHT
AGE = YOUR AGE
APP_ID = YOUR APP ID
API_KEY = YOUR API KEY
exercise_endpoint = "https://trackapi.nutritionix.com/v2/natural/exercise"
exercise_text = input("Tell me which exercises you did: ")
headers = {
"x-app-id": APP_ID,
"x-app-key": API_KEY,
}
parameters = {
"query": exercise_text,
"gender": GENDER,
"weight_kg": WEIGHT_KG,
"height_cm": HEIGHT_CM,
"age": AGE
}
response = requests.post(exercise_endpoint, json=parameters, headers=headers)
result = response.json()
print(result)
@AbiollaghJames
Copy link

AbiollaghJames commented Jun 12, 2024

That documentation is so hard to understand, couldn't find query parameters for some reason.

@Ash-Rich38
Copy link

That documentation is so hard to understand, couldn't find query parameters for some reason.

It's there it's just tucked under and expand menu which was not the easiest to find.

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