Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 1.66 KB

File metadata and controls

77 lines (55 loc) · 1.66 KB

Strava CLI

A simple CLI to interact with the Strava API.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/stravacli.git
    cd stravacli
  2. Create a virtual environment and install:

    python3 -m venv venv
    source venv/bin/activate
    pip install -e .

Configuration

The CLI uses environment variables to authenticate with the Strava API.

  1. Create a .env file in the root directory (you can use .env.example as a template):

    cp .env.example .env
  2. Fill in your Strava API credentials:

    • STRAVA_CLIENT_ID: Your application Client ID.
    • STRAVA_CLIENT_SECRET: Your application Client Secret.
    • STRAVA_ACCESS_TOKEN: Your personal Access Token.

Note

You can obtain these credentials by creating an application at Strava Developers.

Usage

Once installed and configured, you can use the strava command:

Show Version

strava --version

Get Authenticated User Profile

strava whoami

Get Athlete Stats

For the authenticated user:

strava athlete-stats

For a specific athlete ID:

strava athlete-stats 12345678

Shell Autocomplete

The CLI supports automatic command completion for bash, zsh, and fish.

  1. Install completion for your current shell:

    strava --install-completion
  2. Restart your terminal or source your configuration file (e.g., source ~/.zshrc).

  3. Enjoy autocompletion by pressing TAB after typing strava.

References