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 Distribution

various_api_tools-2.0.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

various_api_tools-2.0.1-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file various_api_tools-2.0.1.tar.gz.

File metadata

  • Download URL: various_api_tools-2.0.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.27.0 CPython/3.13.14 Linux/5.15.0-144-generic

File hashes

Hashes for various_api_tools-2.0.1.tar.gz
Algorithm Hash digest
SHA256 73d09805f53c6e2dca12a665f7af21f75797c1dffcc9118f19c4245ae89bae44
MD5 c111f4c3f4d67194a1958c797db2c9dd
BLAKE2b-256 8176b4dd88e32c0a3ae4a34f716e9f5339ab48567ee8aae4a0b3a740d7995b2f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for various_api_tools-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9fad0cee6fe862393a2c1c7e37d46dab2df79892221d2ee905dce150a152055
MD5 0f6a9d027154d464f6efb95fc15b03d0
BLAKE2b-256 bfdcf7e7cb2d6731a1ac2cc01b71044240355f2c45bb63360e56856245020acf

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