A lightweight utility package for common API-related tasks in Python, including JSON and Pydantic error translators that provide user-friendly Russian messages.
Project description
Various_api_tools
A lightweight utility package for common API-related tasks in Python, including JSON and Pydantic error translators that provide user-friendly Russian messages.
Basic Usage
import json
from various_api_tools.translators.json import DecodeErrorTranslator
try:
json.loads('{"name": "Alice",}')
except json.JSONDecodeError as e:
print(DecodeErrorTranslator.translate(e))
# Output:
# Ошибка конвертации в формате JSON.
# Позиция: 16.
# Описание: не правильно используются двойные кавычки.
from pydantic import BaseModel, ValidationError
from various_api_tools.translators.pydantic import ValidationErrorTranslator
class User(BaseModel):
email: str
try:
User(email=123)
except ValidationError as e:
print(ValidationErrorTranslator.translate(e.errors()))
# Output:
# Поле: "email". Ошибка: "Невалидное строковое значение(str)";
Installation
pip install various_api_tools
License
MIT License — feel free to use it in any project! 🎉
Documentation
https://various-api-tools.dkurchigin.ru/
Author
Made with ❤️ by @dkurchigin
Gitverse
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
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 various_api_tools-0.3.4.tar.gz.
File metadata
- Download URL: various_api_tools-0.3.4.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.26.0 CPython/3.13.7 Linux/5.15.0-144-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed46842918c8f9d6883c24506f01c2de630e91f3cc5a40299de3494515d92b28
|
|
| MD5 |
012e59cfe937a07a82af5c3e67cbfe1f
|
|
| BLAKE2b-256 |
e9e7000660ee4926b3174f1f8782cb4160b85053947a451fb18dc7fc4f174a5a
|
File details
Details for the file various_api_tools-0.3.4-py3-none-any.whl.
File metadata
- Download URL: various_api_tools-0.3.4-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.26.0 CPython/3.13.7 Linux/5.15.0-144-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c51e50c984b7f99b888f2c2e7ec455fcd4cf32514172a05570644f596ebba48
|
|
| MD5 |
2d6f4dabbc50930825cfe69f54c923ae
|
|
| BLAKE2b-256 |
73ab729bded8ea4a4267c5fcd7cd057500c3157a328b15b1828795e6470e2600
|