Skip to main content

Decorators, validators, logging and debugging helpers for async HTTP requests

Project description

request_decorator_handlers

Библиотека декораторов для асинхронных HTTP‑клиентов на базе curl_cffi и boss-request:

  • 🎯 единая обёртка Validator со складом ошибок и распарсенных полей;
  • 🧪 валидаторы ответов (status, headers, cookies, content-type, regex);
  • 📦 парсеры (JSONPath, html‑селекторы);
  • 🪵 продвинутый логгер запросов с цветными бейджами статуса и блоком ERRORS;
  • 🧾 декоратор RequestDebugger для записи невалидных запросов и уникальных JSON структур.

Установка

pip install request-decorator-handlers

Быстрый пример

from request_handlers import RequestLogger, ResponseValidator, LOG_ACTION
from request_handlers.decorators import RequestDebugger

@RequestDebugger.debug(save_errors=True)
@RequestLogger.log(LOG_ACTION.FETCH.PROFILE, log_level="success_error")
@ResponseValidator.status([200])
async def fetch_profile(client):
    return await client.get("https://httpbin.org/get")

Что внутри

src/request_handlers/
  core/          # Validator, ValidationError, action константы
  logging/       # RequestLogger + RequestLogFormatter
  validation/    # ResponseValidator (status, headers, regex ...)
  parsing/       # JSONPathParser, HTMLParser
  decorators/    # RequestDebugger
examples/        # демо-скрипты

Подробности и расширенные примеры смотрите в docs/index.md и файлах каталога examples/.

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

request_decorator_handlers-0.1.0.tar.gz (48.8 kB view details)

Uploaded Source

Built Distribution

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

request_decorator_handlers-0.1.0-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file request_decorator_handlers-0.1.0.tar.gz.

File metadata

File hashes

Hashes for request_decorator_handlers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7f966b567fd5bc3f3430001886e573af984fe55fa8c9260a830f0c128b3f50b0
MD5 296f3d9bb1904dc9612e4cf1d4f38688
BLAKE2b-256 b9cbc9f1096c1620ee14d8f9227ac46991ec512d5716fcf23f477a31f3c01437

See more details on using hashes here.

File details

Details for the file request_decorator_handlers-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for request_decorator_handlers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35aec01cb2692cc19acbf4439e80b6262a2960c6723ffb41ccfbba7448b17a03
MD5 a2ef0459c47d8d4795fccf0ec71b2ec8
BLAKE2b-256 25f05cdd0a4e2d9d53579234407d605ef0bf8b8e77baafee76025f29df0f433b

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