Json client
JsonClient
Client to manage JSON files
download_file
download_file(url: str, file_path: Path) -> None
Download a json file from the internet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The url of the JSON to download |
required |
file_path
|
Path
|
the path where to save the file |
required |
load_file
load_file(
file_path: Path, structure: type[Structure]
) -> Structure
Safely load json file from memory using given structure
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
The path where the file is stored |
required |
structure
|
type[Structure]
|
The pydantic structure that matches the file content |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Structure |
Structure
|
An instance of the pydantic structure representing the file structure |