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
- bson
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.2.tar.gz
(28.5 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.2.tar.gz.
File metadata
- Download URL: servextools-0.1.2.tar.gz
- Upload date:
- Size: 28.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4eb579d20469724aad40f9db5b3264415c67d4e3e1589c9a1e4bf099d39f87bc
|
|
| MD5 |
9b3953e5a199db54c25ffe93b0cc50ed
|
|
| BLAKE2b-256 |
01423cbdeca5a46cbf5927b90c252fad6941adc13484763022fdc6553b9f60f9
|
File details
Details for the file servextools-0.1.2-py3-none-any.whl.
File metadata
- Download URL: servextools-0.1.2-py3-none-any.whl
- Upload date:
- Size: 31.5 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 |
e1b11e49214d7dd97d2d2c7b94c1f265767e95401dfceea9756bafe35fa6cd62
|
|
| MD5 |
7f7ba87ff21cd4a13540244a006b0f12
|
|
| BLAKE2b-256 |
d4ae1b1cadac88e53b640fda1b362852e2a554245a98d7999b1f64f7b23869e6
|