Skip to content

Interfaces

SweatStack provides two equivalent interfaces: A singleton interface and a class-based interface.

The singleton interface is recommended for most use cases. It's simpler and ideal for interactive sessions and scripts:

import sweatstack as ss

ss.login()
activities = ss.get_activities()

The class-based interface is intended for more advanced use cases, such as when you need to authenticate multiple users simultaneously or in (multi-threaded) applications:

from sweatstack import Client

client = Client()
client.login()
activities = client.get_activities()

# Multiple clients for different users
client1 = Client(api_key="api-key-1")
client2 = Client(api_key="api-key-2")

client1_activities = client1.get_activities()
client2_activities = client2.get_activities()

The Streamlit integration uses the class-based interface.

Both interfaces provide exactly the same functionality, but serve different use cases.