Skip to main content

Vedro + HTTPX

Project description

vedro-httpx

Codecov PyPI PyPI - Downloads Python Version

Vedro + HTTPX

Installation

Quick

For a quick installation, you can use a plugin manager as follows:

$ vedro plugin install vedro-httpx

Manual

To install manually, follow these steps:

  1. Install the package using pip:
$ pip3 install vedro-httpx
  1. Next, activate the plugin in your vedro.cfg.py configuration file:
# ./vedro.cfg.py
import vedro
import vedro_httpx


class Config(vedro.Config):
    class Plugins(vedro.Config.Plugins):
        class VedroHTTPX(vedro_httpx.VedroHTTPX):
            enabled = True

Usage

AsyncHTTPInterface

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

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 for additional information about vedro-httpx.

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

vedro-httpx-0.4.1.tar.gz (24.8 kB view hashes)

Uploaded Source

Built Distribution

vedro_httpx-0.4.1-py3-none-any.whl (27.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page