Skip to main content

The official Python client for SweatStack

Project description

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.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sweatstack-0.12.0.tar.gz (77.3 kB view details)

Uploaded Source

Built Distribution

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

sweatstack-0.12.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file sweatstack-0.12.0.tar.gz.

File metadata

  • Download URL: sweatstack-0.12.0.tar.gz
  • Upload date:
  • Size: 77.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for sweatstack-0.12.0.tar.gz
Algorithm Hash digest
SHA256 9b0d82764bdd63620f4b8edae00562996081741c924b065a7c73f4d6f8263d88
MD5 e81e7d76d59a1a21fc31fe4a153c458f
BLAKE2b-256 12d3f2093749943c3d124322b177217091780e56c47fab8b0d0414b1ae74c608

See more details on using hashes here.

File details

Details for the file sweatstack-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: sweatstack-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for sweatstack-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d662dc10d4e81331c81d64e44a89749092074db9977fdf2996ab8b726053a75f
MD5 fae6e43625a3fd01f72d4e3b6f89bef1
BLAKE2b-256 5b6baf93f48de9d1bf824817c4736ec111cfe15275fa7a87b28ec39048ffcdf9

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