HttpX Client for Uplink
Project description
uplink-httpx
Uplink-Httpx is an asynchronous HTTP client based on HTTPX for the awesome Uplink REST library.
Use it like any other HTTP client for uplink.
import asyncio
import uplink
from uplink_httpx import HttpxClient
@uplink.headers({"Accept": "application/json"})
@uplink.returns.json()
class HttpBin(uplink.Consumer):
@uplink.get("get")
def get(self):
pass
async def demo():
httpbin = HttpBin(base_url="https://httpbin.org", client=HttpxClient())
resp = await httpbin.get()
print(resp)
# {'args': {}, 'headers': {'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'Host': 'httpbin.org', 'User-Agent': 'python-httpx/0.9.5'}, ... 'url': 'https://httpbin.org/get'}
loop = asyncio.get_event_loop()
loop.run_until_complete(demo())
Features
HTTPX builds on the well-established usability of requests
, and gives you:
- A requests-compatible API wherever possible. No issues between async and sync clients anymore.
- HTTP/2 and HTTP/1.1 support.
- Strict timeouts everywhere.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
uplink-httpx-2.1.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for uplink_httpx-2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c0241c1041501868a439b127e1b9dc5c54842324c42680c1a7fe5d3ba7b6404 |
|
MD5 | cbf1a87efdf6c4f6260e3cf59aba7070 |
|
BLAKE2b-256 | d00f12613d79bb1fbe7a93c1d605d6822d13d26abf065cc5b42631ce30494b1f |