This Flask application integrates with the Strava API to track and validate commute activities for a challenge. It calculates the sum of kilometers commuted to a workplace within a specified challenge period.
- Strava OAuth2 authorization flow
- Fetching Strava activities within a challenge timeframe
- Filtering valid commute activities based on proximity to workplace coordinates
- Summing up the distance of valid commute activities
- Python 3.x
- Flask
- python-dotenv
- A Strava account with an application to obtain
CLIENT_ID
andCLIENT_SECRET
-
Clone the repository: git clone https://github.com/Edios/strava-commute-challange cd commute-challenge-app
-
Install the required Python packages: pip install -r requirements.txt
-
Create a
.env
file in the root directory with the following environment variables:CLIENT_ID=your_strava_client_id CLIENT_SECRET=your_strava_client_secret WORKPLACE_COORDINATES=latitude,longitude TOLERANCE_RADIUS=radius_in_meters PROXIES={‘http’: ‘http://your_proxy’, ‘https’: ‘https://your_proxy’} # Optional- can be removed from app.py
- Start the Flask application: python app.py
- Navigate to
http://IP_HERE:5000/
in your web browser. - Follow the authorization link to authorize the application with your Strava account.
- After authorization, the application will display the sum of kilometers commuted to the workplace during the challenge period.
- Set
debug=True
inapp.run()
for enabling Flask's debug mode. - TODO: Move variables and settings to another module for better configuration management.
Contributions are welcome! Please feel free to submit a pull request.