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 timestampAuthToken- 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:
- Get a token: POST to
/auth_tokenswith your API key + email/password - Use the token: Include
x-rwgps-api-keyandx-rwgps-auth-tokenheaders
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c269abba3db5b6bc3b54057734bb902efa4122f52025ae044ff51ae143b657f
|
|
| MD5 |
0dbc36288a7715778377d5f148ba51ef
|
|
| BLAKE2b-256 |
ecf87e7f3ac36a4d02a6c476e08b65a1001b2239e5fb33f1041212ff4b129889
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b103a29e808df898bd73a6144c95da6c21d863a127a609ee6f07930525abac64
|
|
| MD5 |
8717b8c562ca3ea082ef147afe1c1d3e
|
|
| BLAKE2b-256 |
6e9203855a7e12330f783343731deb82d76441838615cf4da4405a114d900583
|