This Python script tracks your workouts by using the Nutritionix API to get exercise data based on your input, and then sending the workout information to a Google Sheets document using the Sheety API.
- Python 3 installed on your machine
- API credentials for Nutritionix and Sheety
- A Google Sheets document created in your Sheety account
- Clone this repository on your local machine
-
Install the required Python packages by running the following command in your terminal:
pip install requests
-
Export your API credentials as environment variables in your terminal, like this:
export TOKEN=<your-sheety-api-token> export NUTRITION_APP_ID=<your-nutritionix-app-id> export NUTRITION_API_KEY=<your-nutritionix-api-key>
-
Run the script by running the following command in your terminal:
python main.py
- The script will ask you to enter the exercises you did in natural language format. For example, "I ran for 30 minutes and did 20 pushups".
- The script will use the Nutritionix API to get the exercise data and calculate the calories burned.
- The script will then send the workout information to your Google Sheets document using the Sheety API.
The script will output the workout information in the following format:
Exercise: <exercise_name> Duration: <duration_in_minutes> minutes Calories Burned: <calories_burned>
The information will also be sent to your Google Sheets document using the Sheety API.