Name | httpx-structlog JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | None |
upload_time | 2024-10-31 13:25:25 |
maintainer | None |
docs_url | None |
author | Your Name |
requires_python | <4.0,>=3.8 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
Сustom httpx client that logs all requests and responses with structlog.
Usage
```python
from httpx_structlog import AsyncLoggingClient, LoggingClient
# configure structlog
# structlog.configure(
# processors=[structlog.processors.JSONRenderer(sort_keys=True, indent=4)]
# )
# Sync client
with LoggingClient() as client:
client.get("https://httpbin.org/uuid")
# Async client
async with AsyncLoggingClient() as client:
await client.get("https://httpbin.org/uuid")
```
Log example
```json
{
"duration": 0.49533109995536506,
"event": "httpx request",
"host": "httpbin.org",
"method": "GET",
"path": "/uuid",
"request_body": "",
"request_headers": {
"accept": "*/*",
"accept-encoding": "gzip, deflate",
"connection": "keep-alive",
"host": "httpbin.org",
"user-agent": "python-httpx/0.27.0"
},
"request_query": "",
"response_body": "{\n \"uuid\": \"36a2c551-8632-4712-8b56-d3e21819c04e\"\n}\n",
"response_headers": {
"access-control-allow-credentials": "true",
"access-control-allow-origin": "*",
"connection": "keep-alive",
"content-length": "53",
"content-type": "application/json",
"date": "Sat, 13 Jul 2024 12:22:17 GMT",
"server": "gunicorn/19.9.0"
},
"response_status": 200
}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "httpx-structlog",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/fc/20/f98c061c0985ecb0d2aa9bdad06d21210834256d69eb15ea8f8de3aa26cc/httpx_structlog-0.1.0.tar.gz",
"platform": null,
"description": "\u0421ustom httpx client that logs all requests and responses with structlog.\n\nUsage\n\n```python\nfrom httpx_structlog import AsyncLoggingClient, LoggingClient\n\n# configure structlog\n# structlog.configure(\n# processors=[structlog.processors.JSONRenderer(sort_keys=True, indent=4)]\n# )\n\n# Sync client\nwith LoggingClient() as client:\n client.get(\"https://httpbin.org/uuid\")\n\n\n# Async client\nasync with AsyncLoggingClient() as client:\n await client.get(\"https://httpbin.org/uuid\")\n```\n\nLog example\n\n```json\n{\n \"duration\": 0.49533109995536506,\n \"event\": \"httpx request\",\n \"host\": \"httpbin.org\",\n \"method\": \"GET\",\n \"path\": \"/uuid\",\n \"request_body\": \"\",\n \"request_headers\": {\n \"accept\": \"*/*\",\n \"accept-encoding\": \"gzip, deflate\",\n \"connection\": \"keep-alive\",\n \"host\": \"httpbin.org\",\n \"user-agent\": \"python-httpx/0.27.0\"\n },\n \"request_query\": \"\",\n \"response_body\": \"{\\n \\\"uuid\\\": \\\"36a2c551-8632-4712-8b56-d3e21819c04e\\\"\\n}\\n\",\n \"response_headers\": {\n \"access-control-allow-credentials\": \"true\",\n \"access-control-allow-origin\": \"*\",\n \"connection\": \"keep-alive\",\n \"content-length\": \"53\",\n \"content-type\": \"application/json\",\n \"date\": \"Sat, 13 Jul 2024 12:22:17 GMT\",\n \"server\": \"gunicorn/19.9.0\"\n },\n \"response_status\": 200\n}\n```\n",
"bugtrack_url": null,
"license": null,
"summary": null,
"version": "0.1.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "08c3dba4ccaf78d74259b62546f6297e05a8391cbffb7ef2a2616bfdff383878",
"md5": "3ad495c47752bdf8ea1f0ca2f8b8e7fa",
"sha256": "1e36c89a98d8935139608a78bea18a100efc394b643b39eba7d78ba7d32f86ec"
},
"downloads": -1,
"filename": "httpx_structlog-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3ad495c47752bdf8ea1f0ca2f8b8e7fa",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 3226,
"upload_time": "2024-10-31T13:25:23",
"upload_time_iso_8601": "2024-10-31T13:25:23.322863Z",
"url": "https://files.pythonhosted.org/packages/08/c3/dba4ccaf78d74259b62546f6297e05a8391cbffb7ef2a2616bfdff383878/httpx_structlog-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fc20f98c061c0985ecb0d2aa9bdad06d21210834256d69eb15ea8f8de3aa26cc",
"md5": "5747c78bc4db458e0ff190faa9fd2d3c",
"sha256": "ec31f92736de4bff07147ab7bfb045affbf6c2347cc4c4894c3b5232eac33f85"
},
"downloads": -1,
"filename": "httpx_structlog-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "5747c78bc4db458e0ff190faa9fd2d3c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 2466,
"upload_time": "2024-10-31T13:25:25",
"upload_time_iso_8601": "2024-10-31T13:25:25.185765Z",
"url": "https://files.pythonhosted.org/packages/fc/20/f98c061c0985ecb0d2aa9bdad06d21210834256d69eb15ea8f8de3aa26cc/httpx_structlog-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-31 13:25:25",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "httpx-structlog"
}