Python requests like API built on top of Twisted's HTTP client.

twisted twisted Last update: Mar 17, 2024

treq: High-level Twisted HTTP Client API

PyPI calver: YY.MM.MICRO Coverage Documentation

treq is an HTTP library inspired by requests but written on top of Twisted's Agents.

It provides a simple, higher level API for making HTTP requests when using Twisted.

>>> import treq

>>> def done(response):
...     print(response.code)
...     reactor.stop()

>>> treq.get("https://github.com").addCallback(done)

>>> from twisted.internet import reactor
>>> reactor.run()
200

For more info read the docs.

Contributing

treq development is hosted on GitHub.

We welcome contributions: feel to fork and send contributions over. See CONTRIBUTING.rst for more info.

Code of Conduct

Refer to the Twisted code of conduct.

Copyright and License

treq is made available under the MIT license. See LICENSE for legal details and copyright notices.

Subscribe to our newsletter