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.21.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.21.0
File Size Uploaded Provenance Actions
sweatstack-0.21.0.tar.gz 4.0 MB Without provenance Details for sweatstack-0.21.0.tar.gz

Built distribution (wheel)

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

Total release size: 5.9 MB

Release files / sweatstack-0.21.0.tar.gz

Download URL sweatstack-0.21.0.tar.gz
Size 4.0 MB
Tags Source
SHA-256 checksum
How to use checksums
b2bd6b5543d54244a880fc4212fd42dd3c4d6cd1197d55f4e8c728046532d713
BLAKE2b-256 checksum
How to use checksums
b32303a8a862d5c3301594b441189a8c4cdaecac1e52d854512ca7ac65f9fb4b
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.21.0-py3-none-any.whl

Download URL sweatstack-0.21.0-py3-none-any.whl
Size 2.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
84c7805d5b07bdfb2514ff3fac90fa11197f2eabf8c179a888fde67cee3b3dae
BLAKE2b-256 checksum
How to use checksums
be207fb81e1e5b92565f492807a8145252dba788b86c42fd0130913c9fa7cd7b
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.21.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.21.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