HTTP client (httpx) with native yaml support.
Project description
httpxy
HTTP client with yaml support
Adds minor convenience features to the excellent httpx library which aims to make working with yaml easier and safer.
Installation
pip install httpxy
Features
- Always use
safe_load().DONE Responseobjects have aresponse.yaml()for deserializing YAML to adict.DONE- Automatic serialization of objects to yaml.
TODO - Automatic deserializing of yaml to python objects/classes/models.
TODO - Works with multiple yaml packages.
TODO
Examples
Deserialize directly from Response objects.
Equivalent to response.json().
import httpxy
from pprint import pprint
response = httpxy.get("https://mockbin.org/request", headers={"accept": "application/yaml"})
dict_from_yaml = response.yaml()
pprint(dict_from_yaml, sort_dicts=False, depth=1)
{'startedDateTime': '2021-03-06T19:54:03.157Z',
'clientIPAddress': '99.99.999.999',
'method': 'GET',
'url': 'https://mockbin.org/request',
'httpVersion': 'HTTP/1.1',
'cookies': None,
'headers': {...},
'queryString': {},
'postData': {...},
'headersSize': 559,
'bodySize': 0}
print(response.text)
startedDateTime: '2021-03-06T19:54:03.157Z'
clientIPAddress: 99.99.999.999
method: GET
url: 'https://mockbin.org/request'
httpVersion: HTTP/1.1
cookies:
headers:
host: mockbin.org
connection: close
accept-encoding: gzip
x-forwarded-proto: http
cf-visitor: '{"scheme":"https"}'
accept: application/yaml
user-agent: python-httpx/0.17.0
queryString: {}
postData:
mimeType: application/octet-stream
text: ""
params: []
headersSize: 559
bodySize: 0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
httpxy-0.0.0a1.tar.gz
(4.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file httpxy-0.0.0a1.tar.gz.
File metadata
- Download URL: httpxy-0.0.0a1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.9.1 Darwin/20.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eda54ed196f7a3bf4b14e54e3bd8b6c4fc0877eb05433caf2c15d3afb1c80f5c
|
|
| MD5 |
9aeaeab3b9612ec0a9b9b3721e2f9ea1
|
|
| BLAKE2b-256 |
7c093f9b339bff5ecb1317c646cffa4bb690a7ed5dbb0e239e4595075c417a4e
|
File details
Details for the file httpxy-0.0.0a1-py3-none-any.whl.
File metadata
- Download URL: httpxy-0.0.0a1-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.9.1 Darwin/20.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ba6e0dfc8707cf58c0cc4c5b0ef99b7173441ad30962cbd33debad212ec2829
|
|
| MD5 |
11009a262365b86f3dcac7c3d827b614
|
|
| BLAKE2b-256 |
9a383e759de054f9229a5e0f04712b67cea76a66e9f36f4fedac3cfaa81b9706
|