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 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

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-0.3.3.tar.gz (11.4 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-0.3.3-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: various_api_tools-0.3.3.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.26.0 CPython/3.13.5 Linux/5.15.0-144-generic

File hashes

Hashes for various_api_tools-0.3.3.tar.gz
Algorithm Hash digest
SHA256 4794b973832223265a716580240d269569c8c74aef8ae3fb21e660b64c85e300
MD5 b92ab2207218c38127e0a15e63d19491
BLAKE2b-256 a97ed337505ca39c546c2836651f055edcf1664eb6b6258de2a9654d2251210b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: various_api_tools-0.3.3-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.5 Linux/5.15.0-144-generic

File hashes

Hashes for various_api_tools-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 12ecb1502cc04e93cea130a843ccad5cc49c40c071959cf466358c542508fcab
MD5 8f4928c9b517f9ba16f849fe827a45ee
BLAKE2b-256 95faa8041055d5ff5d0519c032e6957b2e832218eb4a44fd199893f8ebaceba7

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