Skip to main content

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 JSONDecodeErrorTranslator

try:
    json.loads('{"name": "Alice",}')
except json.JSONDecodeError as e:
    print(JSONDecodeErrorTranslator.translate(e))

# Output:
# Ошибка конвертации в формате JSON.
# Позиция: 16.
# Описание: не правильно используются двойные кавычки.
from pydantic import BaseModel, ValidationError
from various_api_tools.translators.pydantic import PydanticValidationErrorTranslator

class User(BaseModel):
    email: str

try:
    User(email=123)
except ValidationError as e:
    print(PydanticValidationErrorTranslator.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

https://gitverse.ru/dkurchigin/various-api-tools

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

various_api_tools-1.1.1-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file various_api_tools-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: various_api_tools-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.26.2 CPython/3.13.10 Linux/5.15.0-144-generic

File hashes

Hashes for various_api_tools-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e7bb9029cf025f080cae4f5f8cafc13a3f44c6e93be97f69551ba13061487806
MD5 5e553bbdabb9cec9cab11c2defb33797
BLAKE2b-256 9913c2ef31a3dffab54ca540f1aba9d14010c5d8ebf4364f4d5a792fa05b2c47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page