qmetrics.net

Requests Futures

Asynchronous HTTP sessions using Python futures

A small add-on for the Requests library that returns futures from session calls so multiple HTTP requests can run concurrently via concurrent.futures.

Overview

Requests Futures is a minimal extension to the Python Requests HTTP library that uses the standard library concurrent.futures module. It requires Python 3.10 or newer and keeps the familiar Session API, except calls return Future objects instead of blocking until each Response is ready.

You obtain responses by calling result on each future, and exceptions surface at result time rather than at submit time. By default a ThreadPoolExecutor with eight workers backs the session, sharing one Requests Session across worker threads; the documentation warns that Session is not thread-safe for concurrent mutation of cookies or headers.

The library supports attaching metadata to futures, using as_completed to process finished requests, and using the session as a context manager to cancel queued work on exit. A ProcessPoolExecutor can be supplied for isolation when per-request memory is high, with pickling constraints documented for session subclasses.

Additional documentation covers timeouts, retries through mounted HTTPAdapter and urllib3 Retry, connection pool sizing, streaming caveats, shared executors, hooks, context propagation, and OpenTelemetry. Install via pip install requests-futures.

Key features

  • FuturesSession wraps Requests Session
  • ThreadPoolExecutor default eight workers
  • Optional ProcessPoolExecutor
  • Context manager cancels queued futures
  • Preserves Session method signatures
  • Documented thread-safety guidance

Use cases

  • Parallel HTTP fetches with Requests
  • Overlapping I/O-bound API calls
  • Cleaning up unfinished background requests

Similar software

axios

Promise-based HTTP client for browser and Node.js

Axios is a promise-based HTTP client for JavaScript environments in the browser and Node.js. It supports common request methods, configurable defaults, and interceptors for request and response handling.

★ 109.5k⟳ 2 days agoMIT

FastAPI

Python web framework for building APIs with type hints

FastAPI is a Python web framework for building APIs using standard type hints. It builds on Starlette and Pydantic and generates interactive OpenAPI documentation for the endpoints you define.

★ 105.1k⟳ 9 days agoMIT

OmniRoute

OpenAI-compatible AI gateway with provider routing

OmniRoute exposes one endpoint that routes chat requests across many LLM providers with quota-aware fallback and compression.

★ 90.7k⟳ todayMIT

Hoppscotch

Web, desktop and CLI API development ecosystem

Hoppscotch lets developers send HTTP, WebSocket, GraphQL, and related API requests from a lightweight client. Collections, environments, teams, and sync help organize testing across devices.

★ 81k⟳ 5 days agoMIT
Open Source Alternative to:Postman

NestJS

Progressive TypeScript framework for Node.js backends

Nest organizes Node server apps with modules, dependency injection, and first-party packages for auth, data, queues, and observability.

★ 77.2k⟳ todayMIT

JSON Server

Zero-code mock REST API from JSON data files

JSON Server turns a JSON or JSON5 database file into a REST API for local prototyping. It supports filtering, sorting, pagination, embedding relations, and static assets.

★ 75.7k⟳ 8 months agoMIT