Skip to main content

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 tickers
  • get_articles_by_ticker(ticker, limit=50) — Articles for a specific ticker
  • health() — 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 subscription
  • unsubscribe(tickers) — Remove tickers
  • stop() — 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+
  • httpx for REST
  • websockets for WebSocket

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

rtpr-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rtpr-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

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

Hashes for rtpr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b640ff8865376d4c1adbed999c76a8ee164f84226682437201abffeecce99476
MD5 67c44719e800f5783647678204f8100f
BLAKE2b-256 7d01167e7f031093f895fb1df256b879cf46e963fdba7b6da9da4fdc09779e5a

See more details on using hashes here.

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

Hashes for rtpr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dd2e21f0b739172cfc13a0916262cf9e48c9d7d5fd3a42517b38d12574829ceb
MD5 d5dd4126416e9134c270559cff797a49
BLAKE2b-256 6cd0917ad8429bb99a112f2967014dfc766cb0980482ab07890846f0d571111d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page