Skip to main content

SweatStack Python client library

Quickstart

uv pip install sweatstack
import sweatstack as ss

ss.login()

ss.list_activities()

Authentication

SweatStack supports three authentication methods:

1. Browser-Based OAuth2 Authentication

ss.login()  # Opens your default browser for authentication

2. Direct API Key Authentication

client = ss.Client(api_key="your-api-key")

3. Environment Variable

Set the SWEATSTACK_API_KEY environment variable:

export SWEATSTACK_API_KEY="your-api-key"

SweatStack follows this priority order:

  1. Browser-based OAuth2 (ss.login())
  2. Direct API key via Client constructor
  3. SWEATSTACK_API_KEY environment variable

For example, calling ss.login() or client.login() will override any existing API key authentication, including those set through the constructor or environment variables.

Interfaces: Singleton vs Class-based

This library provides both a singleton interface and a class-based interface.

Singleton interface:

import sweatstack as ss

activities = ss.list_activities()

Class-based interface:

from sweatstack import Client

client = Client()
activities = client.list_activities()

Although both interfaces are feature-equivalent, they serve different purposes:

  • The singleton interface is the default and recommended interface. It is intended for most use cases and is the easiest to use.
  • The class-based interface is intended for more advanced use cases, such as when you need to authenticate multiple users at the same time or in multi-threaded applications.

Streamlit integration

The sweatstack.streamlit module provides a Streamlit integration for SweatStack. This requires the optional streamlit dependency that can be installed with:

uv pip install 'sweatstack[streamlit]'

The StreamlitAuth class is a Streamlit component that handles the OAuth2 authentication flow. It provides a st.authenticate() function that can be used to authenticate the user.

Example usage:

from sweatstack.streamlit import StreamlitAuth

auth = StreamlitAuth()

with st.sidebar:
    st.authenticate()

if not auth.is_authenticated():
    st.write("User is not authenticated")
    st.stop()

st.write("User is authenticated")

auth.client.get_latest_activity()

Metadata

Release files for sweatstack 0.16.0

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

Source distribution (sdist)

Source distribution for sweatstack 0.16.0
File Size Uploaded Provenance Actions
sweatstack-0.16.0.tar.gz 84.4 kB Without provenance Details for sweatstack-0.16.0.tar.gz

Built distribution (wheel)

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

Total release size: 99.1 kB

Release files / sweatstack-0.16.0.tar.gz

Download URL sweatstack-0.16.0.tar.gz
Size 84.4 kB
Tags Source
SHA-256 checksum
How to use checksums
84aac4dbe00ecdc390ab983f7ce9e024a7911b1b5f27a64e2dd281ff8c72fe78
BLAKE2b-256 checksum
How to use checksums
9054f7942e10b8103fb198c3f7297cf74dca0b59c9123f07a2e7d89b2ea587a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Release files / sweatstack-0.16.0-py3-none-any.whl

Download URL sweatstack-0.16.0-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8488dd4bb421172123e59878f32dbb9cfd6b91c4bd2dad3f1a0a52f104ce5536
BLAKE2b-256 checksum
How to use checksums
b77c5d6c46e691a684b0ce55bddead0def50437f0cf663ce09f02cbf8a37974c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Security for sweatstack 0.16.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.16.0 This release

2 release files No provenance

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