-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from ponytailer/simple-init
feature(constructor): Simple init
- Loading branch information
Showing
17 changed files
with
107 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
from example.protocol import BookProtocol, Book | ||
from pydantic_client import PydanticClient, ClientConfig | ||
from pydantic_client.clients import RequestsClient | ||
from example.protocol import BookProtocol, Book, AuthorProtocol, Author | ||
from pydantic_client import pydantic_client_factory, ClientConfig | ||
|
||
if __name__ == "__main__": | ||
cfg = ClientConfig( | ||
client_type="requests", | ||
base_url="https://example.com/api" | ||
) | ||
client = PydanticClient(cfg) \ | ||
.bind_client(RequestsClient) \ | ||
.bind_protocol(BookProtocol) \ | ||
.build() | ||
|
||
pydantic_client_factory.register(cfg)(BookProtocol) | ||
pydantic_client_factory.register(cfg)(AuthorProtocol) | ||
|
||
client = pydantic_client_factory.get_client(BookProtocol) | ||
book: Book = client.get_book(1, "name") | ||
|
||
author_client = pydantic_client_factory.get_client(AuthorProtocol) | ||
author: Author = author_client.get_author() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .requests import RequestsClient | ||
from .aiohttp import AIOHttpClient | ||
from .httpx import HttpxClient | ||
from .httpx import HttpxClient | ||
from .requests import RequestsClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "pydantic-client" | ||
version = "1.0.0" | ||
version = "1.0.1" | ||
description = "Http client base pydantic, with requests or aiohttp" | ||
authors = ["ponytailer <[email protected]>"] | ||
readme = "README.md" | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.