Extension of pydantic models for HTTP send/recieve
Project description
Pydantic-fetch
Extension of pydantic.BaseModel which supports sending and parsing from HTTP endpoints.
Description
BaseModel is extended with two class functions:
fetchto recieve a json payload from an endpoint and validate it as the pydantic modelsubmitto send a pydantic model to an endpoint as a json payload.
Usage
from pydantic_fetch import BaseModel
class User(BaseModel):
id: str
name: str
def send_user(endpoint, id: str, name: str):
user = User(id=id, name=name)
user.submit(endpoint)
def get_user(endpoint):
user = User.fetch(endpoint)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pydantic-fetch-0.0.3.tar.gz
(3.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydantic-fetch-0.0.3.tar.gz.
File metadata
- Download URL: pydantic-fetch-0.0.3.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28aeb0379b2e99e3138c3465d9b3e3ded9facf9aa931b082e152ed75c8f17aae
|
|
| MD5 |
7a2314f1569268d4216949c457f024bc
|
|
| BLAKE2b-256 |
cd6408af5187fc2eed8a4c1d1a954e156d330ed7a7dee60702f82e979b6c2343
|
File details
Details for the file pydantic_fetch-0.0.3-py3-none-any.whl.
File metadata
- Download URL: pydantic_fetch-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41594fced7e6ea5fd549993c59b95fed6de03b4b35c24a0fd0ec9feffc4b9bf9
|
|
| MD5 |
e3a1e0da80ee111977ae0cb36cc3683b
|
|
| BLAKE2b-256 |
0097a567940d9c5f6a58b54d0b24e315d81612a9dd06345e297ad69a26348f3c
|