Official Python SDK for RTPR — real-time press releases in under 500ms
Project description
RTPR Python SDK
Official Python SDK for RTPR — real-time press releases in under 500ms.
Installation
pip install rtpr
Quick Start
REST API
from rtpr import RtprClient
client = RtprClient("your_api_key")
# Get recent articles across all tickers
articles = client.get_articles(limit=10)
for article in articles:
print(f"[{article.ticker}] {article.title}")
# Get articles for a specific ticker
aapl = client.get_articles_by_ticker("AAPL")
WebSocket Streaming
import asyncio
from rtpr import RtprWebSocket
ws = RtprWebSocket("your_api_key")
@ws.on_article
async def handle(article):
print(f"[{article.ticker}] {article.title}")
asyncio.run(ws.connect(tickers=["AAPL", "TSLA"]))
Async REST
from rtpr import AsyncRtprClient
async with AsyncRtprClient("your_api_key") as client:
articles = await client.get_articles(limit=10)
API Reference
RtprClient(api_key, *, base_url, timeout)
Synchronous REST client.
get_articles(limit=20)— Recent articles across all tickersget_articles_by_ticker(ticker, limit=50)— Articles for a specific tickerhealth()— API health check
AsyncRtprClient(api_key, *, base_url, timeout)
Async REST client with the same methods (all awaitable).
RtprWebSocket(api_key, *, ws_url, auto_reconnect)
Real-time WebSocket streaming client.
connect(tickers)— Connect and start streaming (blocking)subscribe(tickers)— Add tickers to subscriptionunsubscribe(tickers)— Remove tickersstop()— Disconnect@on_article— Decorator for article callbacks@on_connect— Decorator for connection callbacks@on_error— Decorator for error callbacks
Article
Dataclass with fields: ticker, title, author, created, article_body, exchange, article_body_html, id, tickers.
Requirements
- Python 3.9+
httpxfor RESTwebsocketsfor WebSocket
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 rtpr-0.1.0.tar.gz.
File metadata
- Download URL: rtpr-0.1.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b640ff8865376d4c1adbed999c76a8ee164f84226682437201abffeecce99476
|
|
| MD5 |
67c44719e800f5783647678204f8100f
|
|
| BLAKE2b-256 |
7d01167e7f031093f895fb1df256b879cf46e963fdba7b6da9da4fdc09779e5a
|
File details
Details for the file rtpr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rtpr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd2e21f0b739172cfc13a0916262cf9e48c9d7d5fd3a42517b38d12574829ceb
|
|
| MD5 |
d5dd4126416e9134c270559cff797a49
|
|
| BLAKE2b-256 |
6cd0917ad8429bb99a112f2967014dfc766cb0980482ab07890846f0d571111d
|