Skip to main content

biostream

Collect your Amazfit/Zepp strap (directly over Bluetooth) and your Oura Ring (cloud), store it locally, and serve everything over GraphQL — including a live heart-rate subscription. One pip install, one call.

Install

pip install biostream

Quickstart

from biostream import serve

# you already have your 16-byte strap key + Oura token:
serve(auth_key="0x<32-hex-chars>", oura_token="<OURA_PAT>")

This starts the background collector and the GraphQL gateway in one process. Open the playground at http://127.0.0.1:8000/graphql.

Don't have the strap key yet? Let biostream fetch it by logging into your Zepp account:

serve(zepp_email="you@example.com", zepp_password="••••", oura_token="<OURA_PAT>")

CLI

biostream serve --auth-key 0x.. --oura-token ..      # collect + serve
biostream scan                                        # find your strap's BLE name
biostream fetch-key --email .. --password ..          # get the 16-byte auth key via a Zepp login

Env vars also work: ZEPP_AUTH_KEY / AUTH_KEY, OURA_TOKEN, STRAP_NAME, DATA_DIR, HOST, PORT, ZEPP_EMAIL / ZEPP_PASSWORD.

Query it

{
  live { connected hr battery steps today { restingHr sleepMinutes } }
  heartRate(limit: 50) { ts bpm }
  oura { nights { day totalH hrv restingHr } readiness { day score } }
  insights { nNights recovery }
}

Live stream (WebSocket subscription):

subscription { heartRateLive { ts bpm } }

Time-series accept start / end (epoch ms) and limit (default 500, max 50000).

What you get

  • Strap (BLE): live HR + steps + battery, plus historical activity, resting/max HR, SpO₂, stress, PAI.
  • Oura (cloud): sleep stages, HRV, resting HR, SpO₂, readiness, daily activity, intraday HR.
  • Insights: a validated Recovery Score, FDR-corrected correlations and trends (improves as the strap accumulates a few days of data).
  • GraphQL gateway: read-only, localhost-only, with a GraphiQL playground and a live-HR subscription.

How it works

Components talk only through a local data dir (~/.local/share/biostream by default): worker (collects) → data/ (SQLite + JSON) → api (GraphQL). An authenticator owns all credentials; nothing else reads your keys.

from biostream import Config, run_worker, create_app
# advanced: run the collector and the API separately, or host create_app(config) under your own ASGI server

Notes

  • The strap must be free (not connected to the phone's Zepp app) while biostream runs — turn off phone Bluetooth.
  • The gateway is open but localhost-only. Don't bind it to a public interface: it serves personal health data with no auth.
  • Getting the strap key requires a one-time Zepp login (fetch-key). Unpairing the strap in the Zepp app invalidates the key.

MIT licensed. Built by reverse-engineering the Huami-2021 / Zepp OS BLE protocol; not affiliated with Amazfit, Zepp, or Oura.

Metadata

Release files for biostream 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for biostream 0.0.1
File Size Uploaded
biostream-0.0.1.tar.gz 31.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for biostream 0.0.1
File Interpreter ABI Platform
biostream-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 70.4 kB

Release files / biostream-0.0.1.tar.gz

Download URL biostream-0.0.1.tar.gz
Size 31.9 kB
Tags Source
SHA-256 checksum
How to use checksums
96384275f7c488d808409727dc5221ffd355e234361b9139d3c88728e068a995
BLAKE2b-256 checksum
How to use checksums
b78b06a4dea9d985b1a0706cb364bcbb64a58ad6f6c109ac7cde70bc4ac8d534
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / biostream-0.0.1-py3-none-any.whl

Download URL biostream-0.0.1-py3-none-any.whl
Size 38.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9afa15af91c02d1069b6a46a58db5578eafced9673eaccbbcc9c463adcadafd
BLAKE2b-256 checksum
How to use checksums
e50ea14102e8524b420f4d24eb28333f5365dac645fb60be4039ab90636c0005
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page