A comprehensive Python library for the BrightSign Network (BSN) Cloud API
Project description
BSN Cloud API Python Library
A comprehensive Python library for interacting with the BrightSign Network (BSN) Cloud API. This library provides easy-to-use functions for managing BrightSign players remotely. At the moment, most non-DWS-related functions are not supported; this release focuses on remote DWS functionality.
Features
- Automatic Authentication - Handles OAuth2 authentication and automatic token renewal
- Extensive rDWS API Coverage – Covers the majority of remote DWS-related BSN Cloud API endpoints
- File Management - Upload, download, and manage files on BrightSign players
- Device Control - Reboot, configure, and control BrightSign devices remotely
- Diagnostics - Run network diagnostics, ping tests, and packet captures
- Video & Display Control - Manage video modes and display settings
- Registry Management - Read and modify player registry settings
- Storage Operations - Manage SD cards and other storage devices
- Advanced Features - SSH, DWS, firmware updates, and more
Installation
pip install bsn-cloud-api
Quick Start
Method 1: Using Environment Variables (Recommended)
Create a .env file in your project root:
BSN_CLIENT_ID=your_client_id_here
BSN_SECRET=your_client_secret_here
BSN_NETWORK=your_network_name_here
Then use the library:
import bsn_cloud_api as bsn
# Get all devices
devices = bsn.get_devices()
# Reboot a player
result = bsn.reboot_device("SERIAL123")
# Upload a file to a player
bsn.put_device_files(
serial_number="SERIAL123",
local_file_path="video.mp4",
file_path="media/videos"
)
Method 2: Programmatic Configuration
import bsn_cloud_api as bsn
# Configure credentials in code
bsn.configure(
client_id="your_client_id",
secret="your_secret",
network="your_network"
)
# Now use the API
devices = bsn.get_devices()
Method 3: System Environment Variables
Set environment variables in your system:
export BSN_CLIENT_ID="your_client_id"
export BSN_SECRET="your_secret"
export BSN_NETWORK="your_network"
Then use the library without any configuration.
Authentication
The library automatically handles authentication for you:
The library automatically manages OAuth2 authentication for all API requests.
Lazy Initialization – No authentication or network requests are made until the first API call.
Automatic Login – Authentication is performed automatically when required.
Token Validity Checking – Before every API request, the library verifies that a valid access token is available.
Automatic Token Refresh – If the access token has expired, a new token is fetched automatically.
Time-Based Expiration – Token validity is determined using the expiration timestamp returned by the OAuth provider.
Network Selection – The configured BSN network is selected automatically after authentication.
Most authentication-related failures are returned as dictionaries containing an error key. Network-level issues (such as connectivity problems) may still raise exceptions from the underlying HTTP library.
You do not need to call login() manually in normal usage — authentication is handled transparently.
API Credentials
To get your BSN Cloud API credentials:
- Log in to https://adminpanel.bsn.cloud
- Select your network
- Navigate to Settings → Applications
- Create a new Application or use an existing one
- Copy your Client ID, Client Secret
Usage Examples
Device Management
# Get all devices
devices = bsn.get_devices()
# Get devices filtered by site
devices = bsn.get_devices(description="London HQ")
# Get specific device info
device = bsn.get_device("SERIAL123")
# Reboot a device
bsn.reboot_device("SERIAL123")
# Factory reset a device
bsn.reboot_device("SERIAL123", factory_reset=True)
File Operations
# List files on SD card
files = bsn.get_device_files("SERIAL123", storage_type="sd", path="media")
# Upload a file
bsn.put_device_files(
serial_number="SERIAL123",
local_file_path="/local/path/video.mp4",
storage_type="sd",
file_path="media/videos",
dest_filename="intro.mp4"
)
# Create a directory
bsn.create_device_directory("SERIAL123", "media/videos")
# Delete a file
bsn.delete_device_file("SERIAL123", "media/old_video.mp4")
# Rename a file
bsn.rename_device_file("SERIAL123", "media/video.mp4", "intro.mp4")
Diagnostics
# Run full network diagnostics
diagnostics = bsn.get_device_diagnostics("SERIAL123")
# Ping a server
ping_result = bsn.get_device_ping("SERIAL123", "8.8.8.8")
# DNS lookup
dns_result = bsn.get_device_dns_lookup("SERIAL123", "google.com")
# Traceroute
trace = bsn.get_device_traceroute("SERIAL123", "google.com")
# Get network configuration
network_config = bsn.get_device_network_config("SERIAL123", interface="eth0")
# Start packet capture
bsn.start_device_packet_capture("SERIAL123", duration=60)
Video & Display Control
# Get current video mode
mode = bsn.get_device_video_mode("SERIAL123")
# Set video mode to 1080p60
bsn.set_device_video_mode("SERIAL123", "1920x1080x60p")
# Get display brightness (Moka displays only)
brightness = bsn.get_display_brightness("SERIAL123")
# Set display brightness
bsn.set_display_brightness("SERIAL123", 75)
# Control display power
bsn.set_display_power_settings("SERIAL123", "standby")
# Set volume
bsn.set_display_volume("SERIAL123", 50)
Registry Operations
# Get entire registry
registry = bsn.get_device_registry("SERIAL123")
# Get specific registry key
value = bsn.get_device_registry_key("SERIAL123", "networking", "dhcp")
# Set registry value
bsn.set_device_registry_key("SERIAL123", "networking", "dhcp", "yes")
# Delete registry key
bsn.delete_device_registry_key("SERIAL123", "customsection", "customkey")
# Flush registry to disk
bsn.flush_device_registry("SERIAL123")
Screenshots & Custom Commands
# Take a screenshot
snapshot = bsn.take_device_snapshot("SERIAL123")
thumbnail = snapshot['data']['result']['remoteSnapshotThumbnail']
# Send custom UDP command
bsn.send_device_custom_command("SERIAL123", "next", return_immediately=True)
# Download firmware
bsn.download_device_firmware(
"SERIAL123",
"https://example.com/firmware.bsfw"
)
API Documentation
For complete API documentation, see the BSN Cloud API Documentation.
Available Functions by Category
Authentication
configure()- Set credentials programmaticallylogin()- Manual login (automatic when needed)
Most API failures are returned as dictionaries containing an error key. Network-level errors may still raise exceptions from the underlying HTTP library.
The API session is lazily initialized. No authentication or network requests occur until the first API call is made.
Device Management
get_devices()- List all devicesget_setups()- List setups/presentations
Control Endpoints
reboot_device()- Reboot or factory resetget_device_password()- Get DWS password statusput_device_password()- Set DWS passwordget_device_local_dws_status()- Check local DWS statusset_device_local_dws()- Enable/disable local DWSreset_device_ssh_host_keys()- Reset SSH keysreset_device_dws_default_certs()- Reset DWS certificates
Storage/File Endpoints
get_device_files()- List filesput_device_files()- Upload filescreate_device_directory()- Create directoriesrename_device_file()- Rename filesdelete_device_file()- Delete files
Diagnostic Endpoints
get_device_diagnostics()- Full network diagnosticsget_device_dns_lookup()- DNS resolution testget_device_ping()- Ping testget_device_traceroute()- Tracerouteget_device_network_config()- Network configurationput_device_network_config()- Update network settingsget_device_network_neighborhood()- Discover nearby playersget_device_packet_capture_status()- Packet capture statusstart_device_packet_capture()- Start packet capturestop_device_packet_capture()- Stop packet captureget_device_telnet_status()- Telnet configurationput_device_telnet_config()- Configure telnetget_device_ssh_status()- SSH configurationput_device_ssh_config()- Configure SSH
Other Endpoints
reformat_device_storage()- Format storage devicereprovision_device()- Re-provision playertake_device_snapshot()- Take screenshotsend_device_custom_command()- Send custom UDP commanddownload_device_firmware()- Update firmware
Video Endpoints
get_device_video_mode()- Convenience method that returns the currently active video modeget_device_video_output()- Get output informationget_device_video_edid()- Get EDID dataget_device_video_power_save()- Power save statusset_device_video_power_save()- Enable/disable power saveget_device_video_modes()- List available modesget_device_video_current_mode()- Exposes the full BSN API and allows querying best, active, configured, or current modes.set_device_video_mode()- Change video mode
Registry Endpoints
get_device_registry()- Get full registryget_device_registry_key()- Get specific keyset_device_registry_key()- Set registry valuedelete_device_registry_key()- Delete registry keyflush_device_registry()- Flush to diskget_device_recovery_url()- Get recovery URLset_device_recovery_url()- Set recovery URL
Advanced Endpoints
get_device_property_lock()- Property lock statusset_device_property_lock()- Configure property lock
Display Control Endpoints (Moka displays only)
get_display_control_all()- All display settingsget_display_brightness()/set_display_brightness()- Brightnessget_display_contrast()/set_display_contrast()- Contrastget_display_volume()/set_display_volume()- Volumeget_display_power_settings()/set_display_power_settings()- Powerget_display_white_balance()/set_display_white_balance()- Colorget_display_video_output()/set_display_video_output()- Outputget_display_always_connected()/set_display_always_connected()- Connectionget_display_always_on()/set_display_always_on()- Always onupdate_display_firmware()- Firmware updateget_display_info()- Display information- And more...
Error Handling
The library returns error dictionaries when requests fail:
result = bsn.get_device_files("INVALID_SERIAL", storage_type="sd")
if "error" in result:
print(f"Error {result['error']}: {result['details']}")
else:
# Success - process result
files = result['data']['result']
Requirements
- Python 3.10+
requests- HTTP librarypython-dotenv- Environment variable management
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details
Support
For issues and questions:
- GitHub Issues: https://github.com/TobiaszGans/py_BSN_Cloud_API/issues
- BSN Cloud API Documentation: https://docs.brightsign.biz/developers/cloud-apis
- BrightSign Support: https://support.brightsign.biz
Design Philosophy
- Simple functional API (no client objects required)
- Single global authenticated session per process
- Thin wrapper around BSN Cloud API responses
- Minimal abstraction: responses closely match API output
Not Yet Supported
- Multi-network concurrent sessions
- Async / asyncio interface
- Automatic retry on rate limits
Changelog
Version 1.0.0 (Initial Release)
- Complete implementation of rDWS BSN Cloud API endpoints
- Automatic authentication and token renewal
- Support for all device control operations
- File management capabilities
- Network diagnostics tools
- Video and display control
- Registry management
- Display control for Moka displays
Author
Tobiasz Gans
Acknowledgments
- BrightSign for providing the BSN Cloud API
Project details
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 bsn_cloud_api-1.0.0.tar.gz.
File metadata
- Download URL: bsn_cloud_api-1.0.0.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec511432c74a69a8bc56183f37d4708323252205521b61a8d60806f3c5db7f60
|
|
| MD5 |
717548e8dd883421af3c2565d5fc2559
|
|
| BLAKE2b-256 |
ea4c9d6e84c7e8802363611cbe627642f7a2914d6439cd331b18d854b4ab55ee
|
File details
Details for the file bsn_cloud_api-1.0.0-py3-none-any.whl.
File metadata
- Download URL: bsn_cloud_api-1.0.0-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e41b63703f1ab57dbfb3cfc26a969e176cb976cc8e9b713cdc3a457034afea5
|
|
| MD5 |
9c761b5d60cb69c7b4334fafaf82e316
|
|
| BLAKE2b-256 |
303243e3c7f572b5900f996c67f32e14e2319a3999681ef305c840e9614ee471
|