Skip to content

Latest commit

 

History

History
86 lines (63 loc) · 3.89 KB

README.md

File metadata and controls

86 lines (63 loc) · 3.89 KB

strava_club_challenge

Automate the data collection and processing to get user activity data from Strava and import it into Google Sheets.

How to use?

Google spreadsheet

  • Each month:
  • Duplicate your Google spreadsheet sheet's original_template.
  • Rename the sheet original_template to template.
  • Set the start day, in the column D2 with format yyyy-mm-dd should be a monday.
  • You should have all your users token created beforehand.
  • If you have a monthly context, rename your spreadsheet's sheet to yyyy-mm.

Runtime

  • Clone repo.
  • Double check environment vars on .env
  • Build docker image
    • sudo docker build -t container_name:0.0.1 .
  • Run
    • docker run --rm --env-file .env -v /Users/full_path/strava_club_challenge_private:/strava_app --entrypoint python container_name:0.0.1 run_strava_club_challenge_in_google_sheets.py

Development Environment

Option 1: Docker and PyCharm pro (Recommended)

Option 2: Local

  • Create a virtual environment. (conda, venv, etc)
  • In Unix-like os export environment vars per session export $(cat .env | xargs)

Configuration from scratch for new project.

  • Configure Strava API account
    • The user should be an administrator in the Club.
    • Get Client ID
    • Get Client Secret
  • Configure google Spreadsheet
    • Create a project in Google Cloud Platform
    • Enabled Google Sheets API and Google Drive API
    • Create a service Account
    • Generate new key
    • Ensure you have the right spreadsheet template, for example for
      • Google Key: 12bZWyGzkf81sXCXmiWQNQk-OaanoVIXByz3QbsY7Mpo
      • Share the spreadsheet with the service account
  • Configure the file .env with your credentials

Permissions

How to contribute?

  • Give me love, welcome any improvement.
  • Create new github issue for each contributions. e.g.
    • Improve documentation
    • Add requirement file.
    • Deploy in a cloud environment (Azure, AWS or GCP).
    • Implement CI/CD
    • Call/push from/to slack.
    • Improve code quality. PEPs
    • Add features:
      • Cloudword with trips.

Restrictions

  • "gspread.exceptions.APIError: {'code': 429, 'message': "Quota exceeded for quota metric 'Read requests' and limit 'Read requests per minute per user' of service 'sheets.googleapis.com' for consumer 'project_number:592854038195'.", 'status': 'RESOURCE_EXHAUSTED', 'details': [{'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'RATE_LIMIT_EXCEEDED', 'domain': 'googleapis.com', 'metadata': {'quota_limit': 'ReadRequestsPerMinutePerUser', 'service': 'sheets.googleapis.com', 'consumer': 'projects/592854038195', 'quota_metric': 'sheets.googleapis.com/read_requests'}}]}"

Base project: