Squadbase Python SDK for Streamlit
Project description
Squadbase Python SDK for Streamlit
SDK for streamlit to get user credentials in deployment environment on squadbase.
Features
- Retrieve user information from Squadbase authentication API
- Support for local development with mock data
- Custom domain configuration
Installation
pip install squadbase-streamlit
or with Poetry:
poetry add squadbase-streamlit
Usage
In Squadbase Deployment Environment
When deployed on Squadbase, the SDK automatically extracts authentication information from the request headers:
import streamlit as st
import squadbase.streamlit as sq
# Get Squadbase user information
user_info = sq.auth.get_user()
# Store in session state for reuse
st.session_state['user_info'] = user_info
# Access user data
st.write(f"Welcome, {user_info.get('firstName', '')} {user_info.get('lastName', '')}")
In Local Development Environment
For local development, you can use mock data to simulate the authentication:
import streamlit as st
import squadbase.streamlit as sq
# Define mock user data for local testing
mock_user_data = {
"username": "testuser",
"firstName": "Test",
"lastName": "User",
"iconUrl": None,
"email": "test@example.com",
"role": ["Admin"]
}
# Get mock user information
user_info = sq.auth.get_user(mock_data=mock_user_data)
# Use the user information in your app
st.write(f"Hello, {user_info['firstName']} {user_info['lastName']}")
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file squadbase_streamlit-0.0.1.tar.gz.
File metadata
- Download URL: squadbase_streamlit-0.0.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.9.4 Darwin/23.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ad67706225b5f489ae8f371ff7f930f0931cb9625bc8688c1879865854344ae
|
|
| MD5 |
144561fa20286bfe50656f4f89432a6f
|
|
| BLAKE2b-256 |
39d84ecc449ddc0c229d8e2e01466b84af3226b0684ef88c98a98c50a47ab0e6
|
File details
Details for the file squadbase_streamlit-0.0.1-py3-none-any.whl.
File metadata
- Download URL: squadbase_streamlit-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.9.4 Darwin/23.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81704c12406624dc5943c3819eb2335f99a87a07c1840c194f94d03b82c4bfe7
|
|
| MD5 |
9daadebc3116f135f6fda2b1c273536a
|
|
| BLAKE2b-256 |
1d8426ca47f441eff6132641ba745731e65827575eea6de5ba49c3ad93f0bc21
|