treq
High-level Twisted HTTP Client API
Decision gist · record as of 2026-08-14
Yes, if you are already using Twisted and need to make HTTP requests. treq significantly reduces boilerplate compared to raw Agent usage and has no known vulnerabilities. The MIT license is unrestrictive. If you are not already committed to Twisted, consider whether a non-Twisted async HTTP library (like httpx or aiohttp) might be simpler for your use case.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Twisted to be installed and running; treq is designed for use within Twisted's reactor-based event loop, not standalone synchronous code.
- Low install friction with six runtime dependencies.
- Actively maintained with a recent release 43 days ago and last commit on 2026-08-08.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) means you can use, modify, and distribute treq freely in commercial and private projects with minimal restrictions.
last release 2026-07-02 (43 days) · last repo commit 2026-08-08 · 604 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 299,531 downloads/mo, #7,858 on PyPI
Alternatives
Verify before relying
import treq
from twisted.internet.task import react
async def main(reactor):
response = await treq.get("https://github.com")
print(response.code)
body = await response.text()
return body
react(main)- Whether treq's API surface and feature parity with requests are sufficient for your specific HTTP use case
- Performance characteristics compared to other async HTTP libraries in the Twisted ecosystem
What it is and what it does
treq bridges the gap between Twisted's low-level HTTP machinery and the simple, intuitive API style of the requests library. It wraps Twisted's Agent with a higher-level interface that lets you make HTTP calls using familiar method names like get(), post(), and put() while staying within Twisted's asynchronous event loop. This makes it easier to write HTTP-heavy Twisted applications without wrestling with Agent's lower-level abstractions.
The library is built on six runtime dependencies: attrs, hyperlink, incremental, multipart, twisted, and typing-extensions. It's designed for developers already committed to Twisted who want a more ergonomic way to handle HTTP requests in their async code. The package is actively maintained, supports modern Python versions (3.9 through 3.14), and runs on both CPython and PyPy.
Use it for
- Making HTTP requests from within a Twisted application without dropping to low-level Agent APIs
- Building web scrapers or API clients that need to integrate with existing Twisted services
- Handling multipart form uploads in async Twisted code using the multipart dependency
- Writing integration tests for Twisted services that need to make outbound HTTP calls
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are already using Twisted and need to make HTTP requests.
treq significantly reduces boilerplate compared to raw Agent usage and has no known vulnerabilities. The MIT license is unrestrictive. If you are not already committed to Twisted, consider whether a non-Twisted async HTTP library (like httpx or aiohttp) might be simpler for your use case.
Install
treq on PyPI
Before you install
Low install friction with six runtime dependencies. Actively maintained with a recent release 43 days ago and last commit on 2026-08-08. Supports Python 3.9 through 3.14 and runs on both CPython and PyPy.
Requires Twisted to be installed and running; treq is designed for use within Twisted's reactor-based event loop, not standalone synchronous code.
License in practice
MIT license (permissive) means you can use, modify, and distribute treq freely in commercial and private projects with minimal restrictions.
Quickstart
import treq
from twisted.internet.task import react
async def main(reactor):
response = await treq.get("https://github.com")
print(response.code)
body = await response.text()
return body
react(main)
Verify before relying
- Whether treq's API surface and feature parity with requests are sufficient for your specific HTTP use case
- Performance characteristics compared to other async HTTP libraries in the Twisted ecosystem
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 6 packagesattrshyperlinkincrementalmultiparttwistedtyping-extensions |
| Maintenance | Actively maintained 43 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 299,531 / month, #7,858 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: TwistedIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy |
Evidence: treq-26.7.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “twisted http client”
- treqtreq is a high-level HTTP client library for Twisted that provides a…
- prometheus-asyncAdds async/await support to Prometheus metrics collection for asyncio…
- spyneSpyne is a framework for building remote procedure call (RPC)…
Give your agent the search over MCP, or paste the wish link into any chat.
More WWW/HTTP packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
h11 is a pure-Python HTTP/1.1 protocol implementation that handles parsing and serializing HTTP messages without any built-in I/O, letting you integrate it with any network layer you choose.
HTTPX is a fully featured HTTP client library for Python that provides both sync and async APIs, with support for HTTP/1.1 and HTTP/2, plus an integrated command-line client.
Install it if you are building new projects or modernizing existing ones that rely on HTTP.
A minimal low-level HTTP client library that sends HTTP requests with thread-safe and task-safe connection pooling, supporting HTTP/1.1, HTTP/2, proxies, and both sync and async interfaces.
aiohttp is an async HTTP client and server framework built on asyncio, supporting both WebSockets and middleware-based routing for building concurrent web applications.
Install it if you need async HTTP client or server capabilities in asyncio-based applications.
See also Twisted · pytest-twisted · prometheus-async · localstack-twisted · txtorcon · crochet · txaio · fetch-use · pytest-tornado · ldaptor