Skip to main content

Utilities for the MyLaps Event Results API

Project description

speedhive-tools

Utilities and examples for interacting with the MyLaps / Event Results API using a locally-generated OpenAPI Python client.

This repository contains a generated client under mylaps_client/ and example scripts that demonstrate how to list events and export session announcements for an organization.

Table of contents

  • Quick start
  • Examples
  • Exporter details
  • Troubleshooting
  • Regenerating the client
  • Contributing

Quick start

Requirements

  • Python 3.10+
  • pip install -r requirements.txt

Create and activate a virtualenv, then install:

python -m venv .venv
# speedhive-tools

Small, practical tools for the MyLaps / Event Results API using a locally-generated OpenAPI Python client.

Quick overview
- Generated client: `mylaps_client/` (importable as `event_results_client` when running examples from the repo root).
- Examples live in `examples/` and are runnable without installing the client.
# 🚀 speedhive-tools

Small, playful utilities for the MyLaps Event Results API  examples included ✨

Why this repo
---------------------------------
- A locally-generated OpenAPI client lives in `mylaps_client/`.
- Example scripts show common tasks (list events, export announcements, fetch laps/results).

Quick start  get running ⚡
---------------------------------
Requirements: Python 3.10+

```bash
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Client usage (one-line) 🧩

Import and construct a client:

from event_results_client import AuthenticatedClient
client = AuthenticatedClient(base_url="https://api2.mylaps.com", token="YOUR_TOKEN")

Regenerating the client

If the OpenAPI spec changes you can regenerate the client and drop it into `mylaps_client/`.

<!-- Lightweight README for speedhive-tools -->
# speedhive-tools

Small utilities to interact with the MyLaps Event Results API using a locally-generated OpenAPI client.

**Quick Start**
- Requirements: Python 3.10+ and a virtualenv.
- Install:

```bash
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

What’s in this repo

  • mylaps_client/ — generated OpenAPI Python client (importable as event_results_client when running examples from the repo root).
  • examples/ — short, runnable examples that demonstrate common API tasks.
  • examples/processing/ — small data-processing helpers (convert NDJSON -> CSV/SQLite).
  • output/ — suggested place for example outputs (this directory is in .gitignore).

Common commands

  • List events for an org:
    python examples/list_events_by_org.py 30476 --verbose
    
  • Export announcements for an org (per-event JSON files):
    python examples/export_announcements_by_org.py 30476 --output ./output/announcements --verbose
    
  • Full dump (stream NDJSON, gzipped by default):
    python examples/export_full_dump.py --org 30476 --output ./output/full_dump --verbose
    

Process exported data

  • Extract laps to CSV:
    python examples/processing/extract_laps_to_csv.py --input output/full_dump/30476 --out output/full_dump/30476/laps_flat.csv
    
  • Import laps to SQLite:
    python examples/processing/ndjson_to_sqlite.py --input output/full_dump/30476/laps.ndjson.gz --out output/full_dump/30476/dump.db
    sqlite3 output/full_dump/30476/dump.db "SELECT COUNT(*) FROM laps;"
    

Notes & tips

  • Run examples from the repository root so the local mylaps_client package is on sys.path.
  • Use --token on example CLIs when endpoints require authentication.
  • The exporter supports --max-events, --max-sessions-per-event, and --dry-run for low-memory testing.
  • Long runs write a checkpoint file (outdir/.checkpoint.json) so you can resume after interruptions.

Regenerating the client If the API OpenAPI spec changes, regenerate the client and place it under mylaps_client/.

Example using openapi-python-client:

python -m openapi_python_client generate --url https://api2.mylaps.com/v3/api-docs --output-path ./mylaps_client

Need help or next steps?

  • I can add CI tests with recorded fixtures, retries and backoff for the exporter, or more processing utilities (aggregation, progress summaries). Tell me which and I’ll implement it.

High-level steps (example using openapi-python-client):

python -m openapi_python_client generate --url https://api2.mylaps.com/v3/api-docs --output-path ./mylaps_client

After regenerating, run the examples to validate and adjust any sanitization logic if payload shapes changed.

Testing and CI

  • There is a minimal import test under tests/ to ensure the generated package imports correctly. Add unit tests or mocks if you want to run the exporter in CI.

Contributing and next steps

If you'd like I can implement any of the following (pick one or more):

  • Add a --concurrency CLI flag to control parallelism.
  • Add an --aggregate flag to emit a single combined file for all events instead of per-event files.
  • Add a unit test that verifies exporter output using recorded fixtures (recommended for CI).

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

speedhive_tools-0.1.0.tar.gz (136.6 kB view details)

Uploaded Source

Built Distribution

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

speedhive_tools-0.1.0-py3-none-any.whl (61.5 kB view details)

Uploaded Python 3

File details

Details for the file speedhive_tools-0.1.0.tar.gz.

File metadata

  • Download URL: speedhive_tools-0.1.0.tar.gz
  • Upload date:
  • Size: 136.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for speedhive_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d075261cea81f39276bd0fa6058da3b61c6d363bca73f005303d4d3fcf562c19
MD5 33bd99f35345555e42f7be510249587a
BLAKE2b-256 6e901de2cb6eca303c721acc3b523a77703f04e45e6ebe70ebcd28ab984bd304

See more details on using hashes here.

File details

Details for the file speedhive_tools-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for speedhive_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44f251679a18a32ac3511e1642cb83ecada41f6b24434f105640df43992b2be9
MD5 bb58536c935f2ac0e41a73f5e7a4959f
BLAKE2b-256 7b9275665654fbeb423e4ab883e92e2a34fb31b5dd6b23dc8e99aea01eb2899a

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