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.0.tar.gz (15.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-2.0.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for various_api_tools-2.0.0.tar.gz
Algorithm Hash digest
SHA256 b27f102907682b0d984dac084c7dfe6f9825d354e6272f3215b8209db719d89c
MD5 d670fe6e0d29047bb16b4169a75ba9d5
BLAKE2b-256 7a6e862b917d95b59acbec4d47bd31b3056ebfed1baabd1d1e0001ddd6484d9e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for various_api_tools-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8cb13f7ed428264a3a4989620066dd3f364839063b2b138c8f0423e818fd76a3
MD5 e8b285f8adac3f45c05688a2d6cef2f8
BLAKE2b-256 59845b651b8e1fa85ddeb20dd7c2e0a3e9a5790c054afb4b72d88ce8823a34cd

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