Skip to main content

wj_common library

Exeption library for backend in Whale and Jaguar

Description

Esta libreria tiene como objetivo brindar al desarrollador un método para responder desde el backend cuando ocurra un error, de acuerdo al estándar propuesto en W&J.

Por otro lado se han dispuesto funcionalidades que son utiles en los diferentes micro servicios desarrollados en W&J. Esto con el fin de centralizar las funciones comunes y evitar la duplicación de código.

Getting started

Requirements

  • Docker
  • GNU make
  • Git

Actualmente se ha construido la librería en el repositorio para paquetes de prueba python TestPyPI por lo que se puede instalar este paquet vía pip.

Install

pip3 install -i https://test.pypi.org/simple/ wj-common

Usage

La librería cuenta con dos paquetes:

  • wj_common: Aquí se encuentran las funcionalidades útiles que se pueden emplear para el desarrollo de nuevas funcionalides en los servicios ofrecidos.

  • wj_exception: Aquí se encuentran las excepciones personalizadas para el manejo de los errores de acuerdo al estándar.

Para obtener las respuestas de acuaerdo a lo planteado se deben usar ambos paquetes como se muestra en el siguiente ejemplo.

from wj_exception.exception.no_data import ItemNotFound
from wj_common.utils import utils

try:
    raise ItemNotFound()
except Exception as e:
    exception_resp = utils.get_response_error(exception=e)
    status = e.status

print(f"response error = {exception_resp}\nstatus = {status}")

Respuesta obtenida:

response error = {'error': {'code': 'itemNotFound', 'message': 'data not found','location': '<stdin> in line 2'}}
status = 404

License

GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007

Metadata

Release files for wj-utilities 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wj-utilities 0.1.0
File Size Uploaded
wj_utilities-0.1.0.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wj-utilities 0.1.0
File Interpreter ABI Platform
wj_utilities-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / wj_utilities-0.1.0.tar.gz

Download URL wj_utilities-0.1.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
31a741b477d31e40d536fdfd0f57622c05cfc8e814274526251619e1b95c9407
BLAKE2b-256 checksum
How to use checksums
1c9d70d4baea3637a555a944d9212df73ae45c67d059b502859dc6e439894ff8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.10 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.6.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.8.13

Release files / wj_utilities-0.1.0-py3-none-any.whl

Download URL wj_utilities-0.1.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c480625a53d286ca896075ab4ae7992e73337ccc07b0465dc65c15aa25a5304
BLAKE2b-256 checksum
How to use checksums
f0517e4926bedd1e215560352282dc42d6e76ee341fdd0cde8fcc5451713409a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.10 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.6.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.8.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page