Vedro + HTTPX
Project description
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:
- Install the package using pip:
$ pip3 install vedro-httpx
- 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 Api(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 Api(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)
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.1.2.tar.gz
(10.1 kB
view hashes)
Built Distribution
Close
Hashes for vedro_httpx-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc1c3474533a4d8a4b97ff6a3c9d4b3eb44cc1e0778f4948f105ac931039a116 |
|
MD5 | 797474a563c74c0c50f8510e1e8753ee |
|
BLAKE2b-256 | 7f9dd386458a82193677ef8ef96753c2c6cfa41ed82be8cb43ac8a70ac3a809b |