Skip to main content

Async Python client for the Ride with GPS API

Project description

aioridewithgps

Async Python client for the Ride with GPS API v1.

Built for use with Home Assistant but can be used independently in any async Python project.

Installation

pip install aioridewithgps

Quick Start

import aiohttp
from aioridewithgps import RideWithGPSClient

async def main():
    async with aiohttp.ClientSession() as session:
        # Authenticate with email/password to get a token
        auth = await RideWithGPSClient.authenticate(
            session,
            api_key="your_api_key",
            email="your@email.com",
            password="your_password",
        )

        # Create a client with the token
        client = RideWithGPSClient(
            session,
            api_key="your_api_key",
            auth_token=auth.auth_token,
        )

        # Get your profile
        user = await client.get_user()
        print(f"Hello, {user.display_name}!")

        # Get all your recorded rides
        trips = await client.get_all_trips()
        for trip in trips[:5]:
            print(f"  {trip.name}: {trip.distance/1000:.1f} km")

        # Get all your planned routes
        routes = await client.get_all_routes()
        print(f"You have {len(routes)} saved routes")

        # Use the sync endpoint for efficient incremental updates
        sync = await client.get_sync(since="2024-01-01T00:00:00Z")
        print(f"{len(sync.items)} changes since Jan 1")

API Coverage

Method Endpoint Description
authenticate() POST /auth_tokens Get auth token with email/password
get_user() GET /users/current Current user profile
get_trips() GET /trips Paginated trip list
get_all_trips() GET /trips All trips (auto-paginates)
get_trip(id) GET /trips/{id} Single trip details
get_routes() GET /routes Paginated route list
get_all_routes() GET /routes All routes (auto-paginates)
get_sync(since) GET /sync Changes since datetime

Data Models

All API responses are parsed into typed dataclasses:

  • User - Account profile (id, email, display_name)
  • TripSummary - Ride stats (distance, duration, speed, HR, power, elevation, etc.)
  • RouteSummary - Planned route info (distance, elevation, terrain)
  • SyncItem - A single change event (created/updated/deleted)
  • SyncResult - Sync response with items and server timestamp
  • AuthToken - Auth token with embedded user profile

Units

All values use the units returned by the RWGPS API:

Metric Unit
Distance meters
Elevation meters
Speed km/h
Duration seconds
Heart rate bpm
Cadence rpm
Power watts
Calories kcal

Authentication

Ride with GPS uses a custom header scheme:

  1. Get a token: POST to /auth_tokens with your API key + email/password
  2. Use the token: Include x-rwgps-api-key and x-rwgps-auth-token headers

The password is only used once to obtain the token. Store the token for subsequent requests.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aioridewithgps-0.1.1.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aioridewithgps-0.1.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file aioridewithgps-0.1.1.tar.gz.

File metadata

  • Download URL: aioridewithgps-0.1.1.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for aioridewithgps-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5c269abba3db5b6bc3b54057734bb902efa4122f52025ae044ff51ae143b657f
MD5 0dbc36288a7715778377d5f148ba51ef
BLAKE2b-256 ecf87e7f3ac36a4d02a6c476e08b65a1001b2239e5fb33f1041212ff4b129889

See more details on using hashes here.

File details

Details for the file aioridewithgps-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: aioridewithgps-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for aioridewithgps-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b103a29e808df898bd73a6144c95da6c21d863a127a609ee6f07930525abac64
MD5 8717b8c562ca3ea082ef147afe1c1d3e
BLAKE2b-256 6e9203855a7e12330f783343731deb82d76441838615cf4da4405a114d900583

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page