Changelog
25.5.0 (2025-05-31)
Features
treq is packaged with Hatchling, and consequently no longer directly depends on setuptools. (#388)
Improved Documentation
Update documentation to use
async/awaitsyntax (#409)
Deprecations and Removals
Support for Python 3.8, which has reached end of support, is deprecated. This is the last release with support for Python 3.8. (#407)
24.9.1 (2024-09-19)
Bugfixes
treq has vendored its dependency on the
multipartlibrary to avoid import conflicts withpython-multipart; it should now be installable alongside that library. (#399)
24.9.0 (2024-09-17)
Features
treq now ships type annotations. (#366)
The new
treq.cookiesmodule provides helper functions for working withhttp.cookiejar.CookieandCookieJarobjects. (#384)Python 3.13 is now supported. (#391)
Bugfixes
treq.content.text_content()no longer generates deprecation warnings due to use of thecgimodule. (#355)
Deprecations and Removals
Mixing the json argument with files or data now raises
TypeError. (#297)Passing non-string (
strorbytes) values as part of a dict to the headers argument now results in aTypeError, as does passing any collection other than adictorHeadersinstance. (#302)Support for Python 3.7 and PyPy 3.8, which have reached end of support, has been dropped. (#378)
Misc
23.11.0 (2023-11-03)
Features
When the collector passed to
treq.collect(response, collector)throws an exception, that error will now be returned to the caller ofcollect()via the resultDeferred, and the underlying HTTP transport will be closed. (#347)Python 3.11 is now supported. (#364)
Python 3.12 is now supported. (#375)
PyPy 3.9 is now supported. (#365)
PyPy 3.10 is now supported. (#374)
Deprecations and Removals
The minimum supported Twisted version has increased to 22.10.0. Older versions are no longer tested in CI. (#374)
Support for Python 3.6, which has reached end of support, has been dropped. (#363)
Support for Python 3.7, which reaches end of support 2023-06-27, is deprecated. This is the last release with support for Python 3.7. (#361)
Support for PyPy 3.7, which has reached end of support, has been removed. (#365)
Support for PyPy 3.8, which has reached end of support, is deprecated. This is the last release with support for PyPy 3.8. (#374)
Misc
22.2.0 (2022-02-08)
Features
Python 3.10 and PyPy 3.8 are now supported. (#338)
Bugfixes
Address a regression introduced in Treq 22.1.0 that prevented transmission of cookies with requests to ports other than 80, including HTTPS (443). (#343)
Deprecations and Removals
Support for Python 3.6, which has reached end of support, is deprecated. This is the last release with support for Python 3.6. (#338)
22.1.0 (2022-01-29)
Bugfixes
Cookies specified as a dict were sent to every domain, not just the domain of the request, potentially exposing them on redirect. See GHSA-fhpf-pp6p-55qc. (#339, CVE-2022-23607)
21.5.0 (2021-05-24)
Features
PEP 517/518
build-systemmetadata is now provided inpyproject.toml. (#329)
Bugfixes
treq.testing.StubTreqnow persiststwisted.web.server.Sessioninstances between requests. (#327)
Improved Documentation
The dependency on Sphinx required to build the documentation has been moved from the
devextra to the newdocsextra. (#296)
Deprecations and Removals
Support for Python 2.7 and 3.5 has been dropped. treq no longer depends on
sixormock. (#318)
21.1.0 (2021-01-14)
Features
Support for Python 3.9: treq is now tested with CPython 3.9. (#305)
The auth parameter now accepts arbitrary text and
bytesfor usernames and passwords. Text is encoded as UTF-8, per RFC 7617. Previously only ASCII was allowed. (#268)treq produces a more helpful exception when passed a tuple of the wrong size in the files parameter. (#299)
Bugfixes
The params argument once more accepts non-ASCII
bytes, fixing a regression first introduced in treq 20.4.1. (#303)treq request APIs no longer mutates a
http_headers.Headerspassed as the headers parameter when the auth parameter is also passed. (#314)The agent returned by
treq.auth.add_auth()andtreq.auth.add_basic_auth()is now marked to providetwisted.web.iweb.IAgent. (#312)treq’s package metadata has been updated to require
six >= 1.13, noting a dependency introduced in treq 20.9.0. (#295)
Improved Documentation
Deprecations and Removals
Support for Python 2.7, which has reached end of support, is deprecated. This is the last release with support for Python 2.7. (#309)
Support for Python 3.5, which has reached end of support, is deprecated. This is the last release with support for Python 3.5. (#306)
Deprecate tolerance of non-string values when passing headers as a dict. They have historically been silently dropped, but will raise TypeError in the next treq release. Also deprecate passing headers other than
dict,Headers, orNone. Historically falsy values like[]or()were accepted. (#294)treq request functions and methods like
treq.get()andHTTPClient.post()now issue aDeprecationWarningwhen passed unknown keyword arguments, rather than ignoring them. Mixing the json argument with files or data is also deprecated. These warnings will change to aTypeErrorin the next treq release. (#297)The minimum supported Twisted version has increased to 18.7.0. Older versions are no longer tested in CI. (#307)
20.9.0 (2020-09-27)
Features
Improved Documentation
An example of sending and receiving JSON has been added. (#278)
20.4.1 (2020-04-16)
Bugfixes
Correct a typo in the treq 20.4.0 package metadata that prevented upload to PyPI (pypa/twine#589)
20.4.0 (2020-04-16)
Features
Support for Python 3.8 and PyPy3: treq is now tested with these interpreters. (#271)
Bugfixes
treq.client.HTTPClient.request()and its aliases no longer raiseUnicodeEncodeErrorwhen passed a Unicode url and non-empty params. Now the URL and query parameters are concatenated as documented. (#264)In treq 20.3.0 the params argument didn’t accept parameter names or values that contain the characters
&or#. Now these characters are properly escaped. (#282)
Improved Documentation
The treq documentation has been revised to emphasize use of
treq.client.HTTPClientover the module-level convenience functions in thetreqmodule. (#276)
20.3.0 (2020-03-15)
Features
Python 3.7 support. (#228)
Bugfixes
treq.testing.RequestTraversalAgentnow passes its memory reactor to thetwisted.web.server.Siteit creates, preventing theSitefrom polluting the global reactor. (#225)treq.testingno longer generates deprecation warnings abouttwisted.test.proto_helpers.MemoryReactor. (#253)
Improved Documentation
The
download_file.pyexample has been updated to do a streaming download with unbuffered=True. (#233)The agent parameter to
treq.request()has been documented. (#235)The type of the headers element of a response tuple passed to
treq.testing.RequestSequenceis now correctly documented asstr. (#237)
Deprecations and Removals
Drop support for Python 3.4. (#240)