Python SDK for shout.run. Broadcast your terminal from code.
Write a script, pipe some output, and anyone with the link watches it live.
Install
pip install shout-run-sdk
Quick Start
from shout_sdk import ShoutSession
session = ShoutSession(api_key='shout_sk_...')
info = session.start(title='My Agent Session')
print(f"Live at: {info['url']}")
session.write('Hello, world!\r\n')
# ... do work ...
session.end()
Context Manager
from shout_sdk import ShoutSession
with ShoutSession(api_key='shout_sk_...') as session:
info = session.start(title='My Agent')
session.write('Working...\r\n')
# session.end() called automatically
Getting an API Key
npm install -g shout-run
shout login
shout api-key create "My Agent"
The key is printed once. Save it somewhere safe. Keys start with shout_sk_.
You can list your keys with shout api-key list and revoke one with shout api-key revoke <id>.
API Reference
ShoutSession(api_key, **kwargs)
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key |
str |
required | API key (starts with shout_sk_) |
title |
str |
'SDK Session' |
Session title shown to viewers |
visibility |
str |
'public' |
'public', 'followers', or 'private' |
cols |
int |
80 |
Terminal columns |
rows |
int |
24 |
Terminal rows |
api_url |
str |
'https://api.shout.run' |
API base URL |
Methods
start()— Creates the session and connects WebSocket. Returns{'session_id', 'url', 'ws_url'}.write(data)— Sends terminal output (strorbytes). Automatically buffered, rate-limited, and chunked.resize(cols, rows)— Updates terminal dimensions.end()— Flushes buffer, sends end frame, closes session.
Static Methods
ShoutSession.delete_session(api_key, session_id, *, api_url='https://api.shout.run')— Delete an ended session (permanent). RaisesRuntimeErroron failure.
ShoutSession.delete_session(api_key='shout_sk_...', session_id='abc123')
ShoutSession.search_sessions(api_key, query, *, tags=None, status=None, limit=20, cursor=None, api_url='https://api.shout.run')— Search sessions by query, tags, and status.
results = ShoutSession.search_sessions(
api_key='shout_sk_...',
query='typescript',
tags=['tutorial'],
status='ended',
limit=10,
)
for session in results:
print(f"{session['title']} by {session['username']}")
ShoutSession.get_session_content(api_key, session_id, *, api_url='https://api.shout.run')— Get session metadata and plain-text transcript.
content = ShoutSession.get_session_content(api_key='shout_sk_...', session_id='abc123')
print(f"Title: {content['session']['title']}")
print(f"Transcript: {content['transcript'][:200]}...")
Properties
state— Current state:SessionState.IDLE,.CONNECTING,.LIVE,.ENDING,.ENDEDviewers— Current viewer countsession_id— Session ID (Nonebefore start)
Events
session.on('connected', lambda: print('Connected!'))
session.on('disconnected', lambda code, reason: print(f'Disconnected: {code}'))
session.on('reconnecting', lambda attempt: print(f'Reconnecting #{attempt}'))
session.on('viewers', lambda count: print(f'Viewers: {count}'))
session.on('error', lambda err: print(f'Error: {err}'))
session.on('state_change', lambda state: print(f'State: {state}'))
Piping Subprocess Output
import subprocess
from shout_sdk import ShoutSession
session = ShoutSession(api_key='shout_sk_...')
info = session.start(title='Running tests')
proc = subprocess.Popen(
['pytest', '-v'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
for line in proc.stdout:
session.write(line)
proc.wait()
session.end()
License
MIT
Metadata
Release files for shout-run-sdk 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| shout_run_sdk-0.3.0.tar.gz | 9.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shout_run_sdk-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.4 kB
Release files / shout_run_sdk-0.3.0.tar.gz
| Download URL | shout_run_sdk-0.3.0.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c37b72da54b448916467cc99b55f4fe881c56e25efd6f5fb1fa041b877e06af
|
|
BLAKE2b-256 checksum How to use checksums |
92789b978bd0fb42d5d94fd9241769c872032e65e0c12e763a0dd58a025de62d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / shout_run_sdk-0.3.0-py3-none-any.whl
| Download URL | shout_run_sdk-0.3.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20c8aff345cb8d8c69507643ea3e9a72961c8f0102dcf9f7732cdc8de7a7b932
|
|
BLAKE2b-256 checksum How to use checksums |
f4ce9fe8d2f9ca16b5418dea3a6f5e83396fef40a3ed70a726ee6f5682a06b8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for shout-run-sdk 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.