Skip to main content

nexrade-req

PyPI Python 3.9+ License: MIT

Fast Python HTTP client for trading bots — bypasses exchange rate limits by routing requests through Nexrade relay nodes.

Part of the Nexrade ecosystem.


How it works

Your bot
   │
   ▼
nexrade-req  ──(no api_key)──▶  direct request to exchange
   │
   └──(with api_key)──▶  https://api.nexrade.com/market-data ──▶  exchange
                         (rotates IPs, bypasses rate limits)
  • Without api_key: behaves like a normal fast HTTP client
  • With api_key: routes through api.nexrade.com/market-data — each request gets a fresh IP, bypassing exchange rate limits

Installation

pip install nexrade-req

Quick start

import nexrade_req as req

# Simple GET (no relay)
r = req.get("https://api.binance.com/api/v3/ticker/price", params={"symbol": "BTCUSDT"})
print(r.status_code, r.json())

# POST
r = req.post("https://httpbin.org/post", json={"key": "value"})
print(r.json())

Using the relay network (bypass rate limits)

from nexrade_req import Client

client = Client(api_key="your_nexrade_api_key")

# All requests are routed through Nexrade relay nodes
r = client.get("https://api.binance.com/api/v3/ticker/price", params={"symbol": "ETHUSDT"})
print(r.json())

Get your API key at nexrade.com or self-host a relay proxy with nexrade-node.


Session (connection reuse)

from nexrade_req import Client

with Client(api_key="your_key") as c:
    r1 = c.get("https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT")
    r2 = c.get("https://api.binance.com/api/v3/ticker/price?symbol=ETHUSDT")

Custom relay nodes

from nexrade_req import Client

client = Client(
    api_key="your_key",
    base_urls=["https://your-own-relay.example.com"],
    endpoint="market-data",
    timeout=10,
    max_retries=3,
)

Fallback client

FallbackClient retries through the relay, then falls back to a direct request if all relay attempts fail.

from nexrade_req import FallbackClient

r = FallbackClient.get(
    "https://api.binance.com/api/v3/ticker/price",
    params={"symbol": "BTCUSDT"},
    max_retries=3,
)
print(r.json())

API reference

Top-level functions

import nexrade_req as req

req.get(url, **kwargs)
req.post(url, data=None, json=None, **kwargs)
req.put(url, data=None, **kwargs)
req.patch(url, data=None, **kwargs)
req.delete(url, **kwargs)
req.head(url, **kwargs)
req.options(url, **kwargs)
req.request(method, url, **kwargs)

Client constructor

Parameter Default Description
api_key None Nexrade API key — enables relay routing
base_urls ("https://api.nexrade.com",) List of relay base URLs
endpoint "market-data" Relay endpoint path
max_retries 1 Retry attempts on failure
timeout 6 Request timeout in seconds
is_random_base_url True Rotate relay nodes randomly
auto_mode False Smart failover — see below

Smart auto-mode (relay ⇄ direct failover)

When auto_mode=True the client watches every relay response. If the relay signals a limit (HTTP 429 / 503, or X-RateLimit-Remaining: 0), the client immediately switches to direct-mode — subsequent requests skip the relay and go straight to the upstream exchange — for the duration of the relay's Retry-After header (default 60 s). Once the cooldown elapses, the client flips back to relay automatically.

client = Client(api_key="your_key", auto_mode=True)

r = client.get("https://api.binance.com/api/v3/ticker/price",
               params={"symbol": "BTCUSDT"})

print(client.mode)              # "relay" or "direct"
print(client.cooldown_remaining) # seconds left in the current cooldown

This protects you from paying a relay-attempt tax when nexrade is already rate-limiting you, and it recovers without any caller intervention.

Common request kwargs

Argument Description
params Query string dict
data Form body or raw bytes
json JSON body
headers Extra HTTP headers
timeout Override timeout per request
proxies Proxy dict {"https": "http://..."}
verify TLS certificate verification

Response

Attribute Description
.status_code HTTP status code
.text Response body as string
.content Response body as bytes
.json() Parse body as JSON
.headers Response headers
.url Final URL
.raise_for_status() Raise on 4xx/5xx

Exceptions

from nexrade_req.exceptions import NexradeException

try:
    r = client.get("https://api.binance.com/...")
except NexradeException as e:
    print("All relay attempts failed:", e)

License

MIT — see LICENSE.


Part of Nexrade

Product Description
nexrade-node Multi-language relay node server
nexrade-req Python HTTP client with relay routing

Metadata

Release files for nexrade-req 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nexrade-req 1.0.5
File Size Uploaded Provenance Actions
nexrade_req-1.0.5.tar.gz 14.9 kB With provenance Details for nexrade_req-1.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nexrade-req 1.0.5
File Interpreter ABI Platform Actions
nexrade_req-1.0.5-py3-none-any.whl Python 3 none any Details for nexrade_req-1.0.5-py3-none-any.whl

Total release size: 29.5 kB

Release files / nexrade_req-1.0.5.tar.gz

Download URL nexrade_req-1.0.5.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
61e38d4a37d6077cb89a73217049705bacb6b45f5960829c4e38b348635dbc54
BLAKE2b-256 checksum
How to use checksums
1f82978a0c8d7237306c1b74e58575ff10d450c3720ee1bb0896c494e5b186e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / nexrade_req-1.0.5-py3-none-any.whl

Download URL nexrade_req-1.0.5-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0979ab9372aba91b47cbbd0edc9f104183877fe97b06a803eb48ec2da4950cf4
BLAKE2b-256 checksum
How to use checksums
b8f87f3910bf5b4850fa780f1d178ff926900c6bcff5efc188c9fa69bd3d466a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Security for nexrade-req 1.0.5

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nexrade_req-1.0.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page