LoginOption#
- class teamworksams.login_option.LoginOption(interactive_mode: bool = True, cache: bool = True)[source]#
Bases:
object
Options for configuring the
teamworksams.login_main.login()
function.Customizes the behavior of
teamworksams.login_main.login()
, controlling interactive feedback and client caching during authentication. Used to tailor the login experience for interactive or automated workflows. See Managing Credentials, Authentication, and Caching for usage.- Parameters:
interactive_mode (bool) – If True, prints status messages during login (e.g., “Logging in…”, “Successfully logged in”). Set to False for silent operation in scripts. Defaults to True.
cache (bool) – If True, stores the authenticated client for reuse by other functions (e.g.,
teamworksams.user_main.get_user()
). Set to False for independent sessions. Defaults to True.
- interactive_mode#
Indicates whether interactive mode is enabled.
- Type:
bool
- cache#
Indicates whether client caching is enabled.
- Type:
bool
Examples
>>> from teamworksams import LoginOption, login >>> option = LoginOption(interactive_mode=True, cache=True) >>> login_result = login( ... url="https://example.smartabase.com/site", ... username="username", ... password="password", ... option=option ... ) ℹ Logging username into https://example.smartabase.com/site... ✔ Successfully logged username into https://example.smartabase.com/site.
Additional Notes#
Set
interactive_mode=True
for user-friendly feedback during login, such as “Successfully logged in,” ideal for interactive scripts or debugging.Used exclusively with login() to customize authentication behavior.
See Also#
login(): Function using
LoginOption
.Managing Credentials, Authentication, and Caching: Authentication configuration examples.