# vedro-httpx
[![Codecov](https://img.shields.io/codecov/c/github/vedro-universe/vedro-httpx/main.svg?style=flat-square)](https://codecov.io/gh/vedro-universe/vedro-httpx)
[![PyPI](https://img.shields.io/pypi/v/vedro-httpx.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-httpx/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/vedro-httpx?style=flat-square)](https://pypi.python.org/pypi/vedro-httpx/)
[![Python Version](https://img.shields.io/pypi/pyversions/vedro-httpx.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-httpx/)
[Vedro](https://vedro.io/) + [HTTPX](https://www.python-httpx.org/)
## Installation
<details open>
<summary>Quick</summary>
<p>
For a quick installation, you can use a plugin manager as follows:
```shell
$ vedro plugin install vedro-httpx
```
</p>
</details>
<details>
<summary>Manual</summary>
<p>
To install manually, follow these steps:
1. Install the package using pip:
```shell
$ pip3 install vedro-httpx
```
2. Next, activate the plugin in your `vedro.cfg.py` configuration file:
```python
# ./vedro.cfg.py
import vedro
import vedro_httpx
class Config(vedro.Config):
class Plugins(vedro.Config.Plugins):
class VedroHTTPX(vedro_httpx.VedroHTTPX):
enabled = True
```
</p>
</details>
## Usage
### AsyncHTTPInterface
```python
from vedro_httpx import Response, AsyncHTTPInterface
class AuthAPI(AsyncHTTPInterface):
def __init__(self, base_url: str = "http://localhost:8080") -> None:
super().__init__(base_url)
async def register(self, creds: dict[str, str]) -> Response:
return await self._request("POST", "/auth/register", json=creds)
```
### SyncHTTPInterface
```python
from vedro_httpx import Response, AsyncHTTPInterface
class AuthAPI(AsyncHTTPInterface):
def __init__(self, base_url: str = "http://localhost:8080") -> None:
super().__init__(base_url)
async def register(self, creds: dict[str, str]) -> Response:
return await self._request("POST", "/auth/register", json=creds)
```
## Documentation
Check out the [documentation](https://vedro.io/docs/integrations/httpx-client) for additional information about `vedro-httpx`.
Raw data
{
"_id": null,
"home_page": "https://github.com/vedro-universe/vedro-httpx",
"name": "vedro-httpx",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Nikita Tsvetkov",
"author_email": "tsv1@fastmail.com",
"download_url": "https://files.pythonhosted.org/packages/17/de/5ff35284768d09d56dcd8aa851b6ab1df321099798aeda343d67dad25fdc/vedro_httpx-0.5.0.tar.gz",
"platform": null,
"description": "# vedro-httpx\n\n[![Codecov](https://img.shields.io/codecov/c/github/vedro-universe/vedro-httpx/main.svg?style=flat-square)](https://codecov.io/gh/vedro-universe/vedro-httpx)\n[![PyPI](https://img.shields.io/pypi/v/vedro-httpx.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-httpx/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/vedro-httpx?style=flat-square)](https://pypi.python.org/pypi/vedro-httpx/)\n[![Python Version](https://img.shields.io/pypi/pyversions/vedro-httpx.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-httpx/)\n\n[Vedro](https://vedro.io/) + [HTTPX](https://www.python-httpx.org/)\n\n## Installation\n\n<details open>\n<summary>Quick</summary>\n<p>\n\nFor a quick installation, you can use a plugin manager as follows:\n\n```shell\n$ vedro plugin install vedro-httpx\n```\n\n</p>\n</details>\n\n<details>\n<summary>Manual</summary>\n<p>\n\nTo install manually, follow these steps:\n\n1. Install the package using pip:\n\n```shell\n$ pip3 install vedro-httpx\n```\n\n2. Next, activate the plugin in your `vedro.cfg.py` configuration file:\n\n```python\n# ./vedro.cfg.py\nimport vedro\nimport vedro_httpx\n\n\nclass Config(vedro.Config):\n class Plugins(vedro.Config.Plugins):\n class VedroHTTPX(vedro_httpx.VedroHTTPX):\n enabled = True\n```\n\n</p>\n</details>\n\n## Usage\n\n### AsyncHTTPInterface\n\n```python\nfrom vedro_httpx import Response, AsyncHTTPInterface\n\nclass AuthAPI(AsyncHTTPInterface):\n def __init__(self, base_url: str = \"http://localhost:8080\") -> None:\n super().__init__(base_url)\n\n async def register(self, creds: dict[str, str]) -> Response:\n return await self._request(\"POST\", \"/auth/register\", json=creds)\n```\n\n### SyncHTTPInterface\n\n```python\nfrom vedro_httpx import Response, AsyncHTTPInterface\n\nclass AuthAPI(AsyncHTTPInterface):\n def __init__(self, base_url: str = \"http://localhost:8080\") -> None:\n super().__init__(base_url)\n\n async def register(self, creds: dict[str, str]) -> Response:\n return await self._request(\"POST\", \"/auth/register\", json=creds)\n```\n\n## Documentation\n\nCheck out the [documentation](https://vedro.io/docs/integrations/httpx-client) for additional information about `vedro-httpx`.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Vedro + HTTPX",
"version": "0.5.0",
"project_urls": {
"Docs": "https://vedro.io/docs/integrations/httpx-client",
"GitHub": "https://github.com/vedro-universe/vedro-httpx",
"Homepage": "https://github.com/vedro-universe/vedro-httpx"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "daa4085511279a7729465ed5f47a4588a2b2b5ffa11e9cc9305ef7ad62997dc3",
"md5": "efa857e6bf77ab917a8727cc47798d83",
"sha256": "01373edccb3c407e4e45a208a207cacc5fb1d4fb3b75f93d20709fb0b3e5255c"
},
"downloads": -1,
"filename": "vedro_httpx-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "efa857e6bf77ab917a8727cc47798d83",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 33690,
"upload_time": "2024-10-14T17:01:12",
"upload_time_iso_8601": "2024-10-14T17:01:12.005061Z",
"url": "https://files.pythonhosted.org/packages/da/a4/085511279a7729465ed5f47a4588a2b2b5ffa11e9cc9305ef7ad62997dc3/vedro_httpx-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "17de5ff35284768d09d56dcd8aa851b6ab1df321099798aeda343d67dad25fdc",
"md5": "9cee236579888fc0c7f12af355454fc5",
"sha256": "017b18c195eb836bb6c0dce8ea281a7de1169a8d2346f8d1faa458d51a82a370"
},
"downloads": -1,
"filename": "vedro_httpx-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "9cee236579888fc0c7f12af355454fc5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 29108,
"upload_time": "2024-10-14T17:01:13",
"upload_time_iso_8601": "2024-10-14T17:01:13.717263Z",
"url": "https://files.pythonhosted.org/packages/17/de/5ff35284768d09d56dcd8aa851b6ab1df321099798aeda343d67dad25fdc/vedro_httpx-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-14 17:01:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vedro-universe",
"github_project": "vedro-httpx",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "vedro-httpx"
}