A minimal RTSP client implemented with the Python standard library only.
Project description
rtspy
A minimal RTSP client implemented with the Python standard library only.
rtspy provides a small, requests-like API for common RTSP operations such as
OPTIONS, DESCRIBE, SETUP, PLAY, PAUSE, and TEARDOWN.
Features
- Pure Python, no third-party runtime dependencies
- Lightweight client object with persistent session support
- One-shot request helper similar to
requests.request - Basic redirect handling
- Minimal SDP helpers for duration and range parsing
- RTSP-only URL validation (
rtsp://)
Requirements
- Python 3.8+
Installation
This package is not published yet.
When published to PyPI, install with:
pip install rtspy
For local development right now:
git clone <your-repo-url>
cd rtspy
Quick Start
import rtspy
client = rtspy.Client("rtsp://example.com/live")
resp = client.describe()
print(resp.status_code)
print(resp.headers)
print(resp.text)
client.close()
One-shot request style:
import rtspy
resp = rtspy.request("OPTIONS", "rtsp://example.com/live")
print(resp.status_code, resp.reason)
URL Support
Only rtsp:// URLs are supported.
If a non-RTSP URL is used, rtspy raises ValueError or RTSPError depending
on the operation.
API Overview
Client
Client(rtsp_server_uri, timeout=8.0, user_agent="rtspy/0.1", allow_redirects=True, max_redirects=5, auto_connect=True)
Main methods:
options(uri=None, headers=None)describe(uri=None, headers=None)setup(uri=None, headers=None, transport="RTP/AVP/TCP;unicast;interleaved=0-1")play(uri=None, headers=None, range_header=None)pause(uri=None, headers=None)teardown(uri=None, headers=None)set_parameter(uri=None, headers=None, body=None)get_parameter(uri=None, headers=None, body=None)request(method, uri=None, headers=None, body=None, allow_redirects=None, max_redirects=None)
Response
Response contains:
status_codereasonversionheadersbodyraw
Convenience properties:
textbody_textbody_linesbody_kvnpt_rangeduration_seconds
Error Handling
RTSPError: base exception for protocol/parsing related issuesRTSPConnectionError: connection and socket-level failures
License
This project is licensed under the terms in LICENSE.
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 rtspy-0.1.0.tar.gz.
File metadata
- Download URL: rtspy-0.1.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c3e0d3a97196986c59ebe02e6b2cd7417d4dff4c11d3457e95cea0a04087308
|
|
| MD5 |
d3bdcc617bf102e5bb9e46c9bb912851
|
|
| BLAKE2b-256 |
ffcecf66f563e60b6e67bbede643f28a1f134fd32c8c05c6401b52b513aeba78
|
File details
Details for the file rtspy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rtspy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1f21707aa9323232ad47d2447691ffc66350a67e7a06c91149a14201512068e
|
|
| MD5 |
1aa78cacbaafc5e1ece99ab665fe8760
|
|
| BLAKE2b-256 |
061c2e4f101ea602773643a7e92279e829e9eeb6899f4bd57ba051d3f6dc98a0
|