Metadata-Version: 2.4
Name: vedro-httpx
Version: 0.7.0
Summary: Vedro + HTTPX
Home-page: https://github.com/vedro-universe/vedro-httpx
Author: Nikita Tsvetkov
Author-email: tsv1@fastmail.com
License: Apache-2.0
Project-URL: Docs, https://vedro.io/docs/integrations/httpx-client
Project-URL: GitHub, https://github.com/vedro-universe/vedro-httpx
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx<1.0,>=0.24
Requires-Dist: vedro<2.0,>=1.7
Requires-Dist: PyYAML<7.0,>6.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 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`.
