Herramientas para Servextex
Project description
ServexTools
Herramientas avanzadas para Servextex: utilidades para manejo de datos, logs, fechas, sockets y replicación MongoDB.
Tabla de Contenidos
Instalación
pip install servextools
Módulos y Funcionalidades
Tools.py
Funciones generales y utilidades:
- FormatearValor(valor): Convierte valores Decimal a float.
- StrToDate(dato): Convierte string a fecha.
- Mensaje / MensajeV2: Genera respuestas estándar para APIs.
- Encriptar: Encripta datos con JWT.
- AgregarActualizarCampo / EliminarArea / CambiarNombreColeccion: Utilidades para colecciones MongoDB.
- WriteFile, EscribirLog: Manejo de archivos y logs.
EscribirLog.py
- EscribirLog(texto, tipo): Escribe logs de error y éxito.
- EscribirConsola, EscribirProcesos, EscribirUpdate: Logs especializados para consola y procesos.
GetTime.py
- Utilidades para manejo avanzado de fechas y horas.
Enumerable.py
- Enumeraciones útiles para tu aplicación.
Table.py
- CrearTabla, CrearTablaReport: Generación de tablas HTML dinámicas a partir de datos.
- Formatos: Formatea columnas según tipo (fecha, moneda, etc).
ReplicaDb.py
- Utilidades para replicación y manejo avanzado de bases de datos MongoDB.
socket_manager.py
- Gestión de WebSockets usando Flask-SocketIO para aplicaciones en tiempo real.
conexion.py
- Get, GetDB, ProcesarDatos: Abstracciones para conexión y operaciones con MongoDB.
- TypeConnection: Obtiene parámetros de conexión seguros.
Ejemplos de Uso
Formateo y utilidades generales
from ServexTools import Tools
from decimal import Decimal
# Formatear un valor decimal
dato = Tools.FormatearValor(Decimal('123.45'))
print(dato)
# Manejo de fechas
fecha = Tools.StrToDate("19/04/2025")
print(fecha)
# Encriptar datos
jwt_token = Tools.Encriptar("mi_dato", "mi_clave_secreta")
print(jwt_token)
Manejo de logs
from ServexTools import EscribirLog
EscribirLog.EscribirLog("Mensaje de prueba", tipo="Exito")
Conexión y operaciones MongoDB
from ServexTools import conexion
# Obtener colección y cliente
collection, client = conexion.Get("mi_coleccion")
# Insertar un documento
doc = {"nombre": "Juan", "edad": 30}
collection.insert_one(doc)
Generación de tablas HTML
from ServexTools import Table
datos = [
{"Nombre": "Juan", "Edad": 30},
{"Nombre": "Ana", "Edad": 25}
]
columnas = ("Nombre", "Edad")
html = Table.CrearTabla(datos, NombreColumnas=columnas)
print(html)
Dependencias
- flask
- pymongo
- pytz
- PyJWT
- httpx
- eventlet
- flask-socketio
- tqdm
- polars-lts-cpu
- numpy
Licencia
MIT - Ver archivo LICENSE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
servextools-0.1.7.tar.gz
(41.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file servextools-0.1.7.tar.gz.
File metadata
- Download URL: servextools-0.1.7.tar.gz
- Upload date:
- Size: 41.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8db722aee87a99328283798675b9267a3c2594af0dbd98f8bb7c359521a84a9c
|
|
| MD5 |
e46297578694805f339c39c0539fc17b
|
|
| BLAKE2b-256 |
eb3b33dbcb3c92cd9a095a2ebdbe6985cd2a84d4cacae1fd177c43dac274b01f
|
File details
Details for the file servextools-0.1.7-py3-none-any.whl.
File metadata
- Download URL: servextools-0.1.7-py3-none-any.whl
- Upload date:
- Size: 42.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4432c619283592118011721c12b53fe160c651859e2a535ff7bb9e8899a1dca
|
|
| MD5 |
94a3e05a5ff40fe8d4712b0c110bde68
|
|
| BLAKE2b-256 |
c7985f70cc2dab1da576dc564f9dbba0339d2a435a11f5949124ca55463ad498
|