https://github.com/technige/httq
https://github.com/technige/httq
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/technige/httq
- Owner: technige
- License: apache-2.0
- Created: 2015-03-10T23:05:19.000Z (over 11 years ago)
- Default Branch: v1
- Last Pushed: 2020-10-15T16:25:03.000Z (over 5 years ago)
- Last Synced: 2023-04-01T12:24:47.195Z (about 3 years ago)
- Language: Python
- Size: 181 KB
- Stars: 0
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
====
HTTQ
====
HTTQ is a fast and lightweight HTTP client written in pure Python and distributed under the Apache 2 license.
It is contained within a single file module with no external dependencies so it can be easily dropped into existing projects.
The `HTTP` class has separate methods for sending requests and receiving responses.
This decoupling allows multiple requests to be pipelined on a single connection prior to the corresponding responses being read.
Example Code
============
Open an HTTP connection to `http.io` on port 8080, send a `GET` request to `/hello` and obtain the response content:
.. code:: python
>>> from httq import HTTP
>>> http = HTTP(b"httq.io:8080")
>>> print(http.get(b"/hello").response().content)
hello, world
Get the same content using a full URL on a single-use connection:
.. code:: python
>>> from httq import get
>>> print(get(b"http://httq.io:8080/hello").content)
hello, world