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.6.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.6-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: various_api_tools-0.3.6.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.6.tar.gz
Algorithm Hash digest
SHA256 a5c75ba5d87e8483f161e80b6240ef6efd838404a49b7db2e35cbb91523b81ae
MD5 d12b763c76067a2b2e7a4da1774aebb1
BLAKE2b-256 4a6dd8a5d96a02114d3a6cb73d5dd0e1bfb03675a7692293e5f6307b7c4bf51f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: various_api_tools-0.3.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 057bb0e2e1501ae8758f75ac18e43023fd45bf329b1361e2700f6e0ba0e6fa2c
MD5 9a3826f0fe73cb78c3a7735be9559a6a
BLAKE2b-256 3b2b4d26f0fa43a2d8c2d11702d3370ff4cacc6dd4694347daab11f641afa669

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