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-1.0.0.tar.gz (14.8 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-1.0.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: various_api_tools-1.0.0.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.26.2 CPython/3.13.11 Linux/5.15.0-144-generic

File hashes

Hashes for various_api_tools-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2f9965d0541c2c240e27cedb2e277bf814d1438a216d179fd1cc805d6c4813dd
MD5 6a27b0e4c9b25fa958ce0e2d866b6b8e
BLAKE2b-256 35b0a7cc27ed029c68fc6cfa3a5c1647b70dbc1f9823f0bed5e788a5243689dd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: various_api_tools-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.0 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24fb663e6c5cedd893f20e1c0df5232b6bb8e54a2c7751347dfa326e09f9fa13
MD5 48b04327ce9cb6c782c51e3853377acf
BLAKE2b-256 b6e2c83a4248f37a9d4009220818b0b083a5abef2bffafb7101d1763a29b556a

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