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.1.tar.gz
(10.1 kB
view hashes)
Built Distribution
Close
Hashes for vedro_httpx-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9bb58e997273aa2f07e9864247d5ceb74ad52a3ba168c7d5edecaaef0848088 |
|
MD5 | aa5d2bd37e57716490b4bed8de672bc8 |
|
BLAKE2b-256 | ab9ff5ef35ff8c09ce40f64cc9a9b04fded14a42ddb23f153a1a9bd2e9dece2d |