Skip to main content

fastreq 3.0.0

PyPI Version Python Version License: MIT

High-performance async HTTP client built on niquests (default) and httpx (optional).

Features

  • Two transports: niquests (default, required) and httpx (optional extra)
  • HTTP/2 support via niquests/qh3 (always) and httpx+hyper (when h2 installed)
  • Explicit proxy pools with health tracking, cooldown, round-robin rotation, and Webshare import — no free-proxy discovery
  • Token-bucket rate limiting — rate token acquired before the concurrency slot
  • Typed retry — only transient transport errors and configured retryable status codes (429, 500, 502, 503, 504); honors Retry-After
  • User-agent rotation from a built-in list or custom list
  • Cookie management with session-scoped, proxy-isolated storage
  • Chunked streaming via callbacks in both transports
  • Flexible response parsing — JSON, text, content, response object, or stream
  • Keyed responses for dict-style result mapping

Installation

# Core library (niquests is the default and required transport)
pip install fastreq

# With HTTPX as an alternative transport
pip install fastreq[httpx]

# With HTTP/2 support for httpx (niquests supports HTTP/2 natively)
pip install fastreq[httpx,h2]

Quick Start

Sync Usage

from fastreq import fastreq

result = fastreq("https://api.github.com/repos/python/cpython")
print(result)

Async Usage

import asyncio
from fastreq import fastreq_async

async def main():
    results = await fastreq_async([
        "https://api.github.com/repos/python/cpython",
        "https://api.github.com/repos/python/cpython/issues",
    ], concurrency=5)
    return results

results = asyncio.run(main())

Context Manager

from fastreq import FastRequests

async def main():
    async with FastRequests(concurrency=5) as client:
        result = await client.request("https://api.github.com/repos/python/cpython")
    return result

Streaming

from fastreq import FastRequests, ReturnType

async def main():
    async with FastRequests() as client:
        await client.request(
            "https://example.com/large-file.zip",
            return_type=ReturnType.STREAM,
            stream_callback=lambda chunk: print(f"Got {len(chunk)} bytes"),
        )

Explicit Proxy Rotation

from fastreq import FastRequests

# Provide a proxy list directly
proxies = [
    "http://user:pass@proxy1:8080",
    "http://user:pass@proxy2:8080",
]

async with FastRequests(
    proxies=proxies,
    random_proxy=True,
    proxy_selection="round_robin",
    proxy_cooldown=60.0,
) as client:
    result = await client.request("https://api.example.com/data")

You can also set proxies via the FASTREQ_PROXIES environment variable (comma-separated) or import from a Webshare text file via webshare_file=.

Backend Selection

Backend Status HTTP/2 Install
niquests Default Native pip install fastreq
httpx Optional h2 dep pip install fastreq[httpx]

backend="auto" (the default) always selects niquests. To use httpx explicitly:

FastRequests(backend="httpx")

Migration from 2.x to 3.0

Breaking changes

  • Removed backends: aiohttp and requests transports are gone. Use niquests (default) or httpx.
  • Removed free proxies: The library no longer discovers or fetches free proxies. Provide explicit proxies via proxies=, FASTREQ_PROXIES, or webshare_file=.
  • Canonical name: The project is now fastreq (previously parallel-requests). ParallelRequests remains as a Python alias for backward compatibility.

What to do

  1. If you used backend="aiohttp" or backend="requests", switch to the default niquests transport or install fastreq[httpx] and use backend="httpx".
  2. If you used free_proxies=True, remove it and provide an explicit proxy list or Webshare source instead.
  3. If you imported ParallelRequests, it still works as an alias — but the canonical name is FastRequests.

Proxy Policy

fastreq 3.0 does not fetch free proxies. Proxy sources in priority order:

  1. proxies= constructor argument (list of URLs)
  2. FASTREQ_PROXIES environment variable (comma-separated)
  3. webshare_file= path to a Webshare plain-text proxy file (ip:port:user:password per line)

Failed proxies enter a configurable cooldown. Successful requests clear the cooldown. Selection strategies: round_robin (default) or random.

Documentation

Development

This project uses uv for dependency management and packaging.

# Install all dependencies
uv sync --all-groups

# Run quality gates
uv run ruff format --check .
uv run ruff check .
uv run ty check src
uv run pytest -q

# Build
uv build

License

MIT License — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastreq-3.0.0.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

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

fastreq-3.0.0-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file fastreq-3.0.0.tar.gz.

File metadata

  • Download URL: fastreq-3.0.0.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for fastreq-3.0.0.tar.gz
Algorithm Hash digest
SHA256 659c3d6652ecdcb3cd13a00b2dfac4af51fc77b15ef726a860c159a581d5a081
MD5 b1c4fbef21c55faac49eceb9ba8346a2
BLAKE2b-256 9e936892ce6d0825e744c5c1f2ab2ff848c47bf2d4ef1d3213794d2e2e0bc826

See more details on using hashes here.

File details

Details for the file fastreq-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: fastreq-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 31.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for fastreq-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f28f4f722b3344fd99a7f30b34c845ee82cf4f6c9cfe45ee785189e98f67ec58
MD5 7a18b3b4a1cbaebe363abc9c0b8f8694
BLAKE2b-256 ac2eed4e5f50e8a884df9e9881da031ad2ae7325499270c9d1555382b336ea23

See more details on using hashes here.

Release history Release notifications | RSS feed

3.2.1

2 files

3.2.0

2 files

3.1.1

2 files

3.1.0

2 files

This release

3.0.0 This release

2 files

2.0.2

2 files

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