Python SDK for the PolyBridge public API.
Project description
PolyBridge Python SDK
Python SDK for the stable PolyBridge public API.
v0.1 scope is intentionally small: Search, Forecast, and Health only. It does not include Markets, Situation Room, streaming Forecast, MCP, pandas helpers, or analytics/timeseries utilities.
Installation
After release:
pip install polybridge
From a local checkout:
python -m pip install -e .
Anonymous Search
Search can be used without an API key.
from polybridge import PolyBridge
client = PolyBridge()
response = client.search(
"US recession risk",
top_k_per_dimension=3,
filters={"status": "active"},
)
for result in response.results.get("direct", []):
print(result.question, result.platform_url)
API-Key Search
When an API key is configured, the SDK sends it as
Authorization: Bearer <api_key>.
from polybridge import PolyBridge
client = PolyBridge(api_key="YOUR_POLYBRIDGE_API_KEY")
response = client.search(
"US recession risk",
top_k_per_dimension=3,
filters={"status": "active"},
)
You can also use the POLYBRIDGE_API_KEY environment variable.
export POLYBRIDGE_API_KEY="YOUR_POLYBRIDGE_API_KEY"
from polybridge import PolyBridge
client = PolyBridge()
client.health()
Forecast
Forecast requires an API key. If no key is configured, the SDK raises a local
AuthenticationError before making a network request.
from polybridge import PolyBridge
client = PolyBridge(api_key="YOUR_POLYBRIDGE_API_KEY")
forecast = client.forecast(
"Will there be a US recession in 2026?",
include_graph=True,
)
print(forecast.probability)
print(forecast.reasoning)
Raw Responses
Use with_raw_response when you need HTTP metadata such as response headers or
the raw body.
from polybridge import PolyBridge
client = PolyBridge(api_key="YOUR_POLYBRIDGE_API_KEY")
raw = client.with_raw_response.forecast("Will the Fed cut rates?")
print(raw.status_code, raw.request_id)
print(raw.parsed.probability)
Configuration
from polybridge import PolyBridge
client = PolyBridge(
api_key="YOUR_POLYBRIDGE_API_KEY",
base_url="https://api.polybridge.ai",
timeout=10.0,
forecast_timeout=120.0,
attribution_code="partner-code",
referrer="https://example.com",
)
Attribution headers are only sent when values are provided.
Errors And Rate Limits
All SDK exceptions inherit from PolyBridgeError.
from polybridge import PolyBridge, RateLimitError
client = PolyBridge(api_key="YOUR_POLYBRIDGE_API_KEY")
try:
client.forecast("Will the Fed cut rates?")
except RateLimitError as error:
print(error.status_code)
print(error.request_id)
print(error.retry_after)
Status errors expose status_code, detail, request_id,
response_headers, raw_body, and for rate limits, retry_after.
Security
Do not expose long-lived PolyBridge API keys in browser or mobile clients. Route requests through a trusted backend you control.
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 polybridge-0.1.0.tar.gz.
File metadata
- Download URL: polybridge-0.1.0.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8ff9ba9b98bf31971786846d39d8c91f17fe05b683900c5ed4f4c39e69fb5b7
|
|
| MD5 |
8ba023bca0dd6bd4d66314112cb2b8d8
|
|
| BLAKE2b-256 |
52e91f760495e6bc87227b1ba43143d2a0e6dcc2e2713330d48f230d9e40df34
|
Provenance
The following attestation bundles were made for polybridge-0.1.0.tar.gz:
Publisher:
publish.yml on crowdvector/polybridge-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polybridge-0.1.0.tar.gz -
Subject digest:
a8ff9ba9b98bf31971786846d39d8c91f17fe05b683900c5ed4f4c39e69fb5b7 - Sigstore transparency entry: 1757157680
- Sigstore integration time:
-
Permalink:
crowdvector/polybridge-python@fa9054777b606b3985f24bc91c811312de0eae07 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/crowdvector
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fa9054777b606b3985f24bc91c811312de0eae07 -
Trigger Event:
push
-
Statement type:
File details
Details for the file polybridge-0.1.0-py3-none-any.whl.
File metadata
- Download URL: polybridge-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06aa8165c0e6b7484a23525122771906592dc2fef19da5ed3e54981c268a0b2d
|
|
| MD5 |
b3f4ed30eaf6c11edbd6f16a69cb4c1a
|
|
| BLAKE2b-256 |
a8b4c511a982a66c5c3dde2df61775f8be2f726908d8e99b90c3ec98b51cd12e
|
Provenance
The following attestation bundles were made for polybridge-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on crowdvector/polybridge-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polybridge-0.1.0-py3-none-any.whl -
Subject digest:
06aa8165c0e6b7484a23525122771906592dc2fef19da5ed3e54981c268a0b2d - Sigstore transparency entry: 1757157768
- Sigstore integration time:
-
Permalink:
crowdvector/polybridge-python@fa9054777b606b3985f24bc91c811312de0eae07 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/crowdvector
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fa9054777b606b3985f24bc91c811312de0eae07 -
Trigger Event:
push
-
Statement type: