feat: Introduce bot-descarga service for PDF downloads and remote bot control. Add Docker configuration, environment variables, and a GUI for agent management. Enhance README with bot details and installation instructions.

This commit is contained in:
erik
2026-07-12 21:20:29 -05:00
parent a75ccce13f
commit 103bcea15b
66 changed files with 4469 additions and 13 deletions
@@ -0,0 +1,61 @@
from __future__ import annotations
import tempfile
from pathlib import Path
from openpyxl import Workbook
from bot_descarga.infrastructure.excel_reader import ExcelReader, limpiar_nombre_carpeta
def _make_excel(rows, path: Path) -> Path:
wb = Workbook()
ws = wb.active
for row in rows:
ws.append(row)
wb.save(path)
return path
def test_limpiar_nombre_carpeta_caracteres_invalidos():
assert limpiar_nombre_carpeta(r"900/123:456") == "900_123_456"
assert limpiar_nombre_carpeta(" ") == "SIN_NIT"
assert limpiar_nombre_carpeta("") == "SIN_NIT"
def test_excel_reader_lee_radicados_y_nit():
with tempfile.TemporaryDirectory() as tmp:
path = Path(tmp) / "datos.xlsx"
_make_excel(
[
["Radicado", "NIT"],
["100001", "900111222"],
["100002", "900111222"],
["100003", None],
["", "800"],
],
path,
)
records = ExcelReader().read(str(path))
assert len(records) == 3
assert records[0].radicado == "100001"
assert records[0].nit == "900111222"
assert records[2].nit == "SIN_NIT"
def test_excel_reader_omite_encabezados_variantes():
with tempfile.TemporaryDirectory() as tmp:
path = Path(tmp) / "datos.xlsx"
_make_excel(
[
["proceso", "nit"],
["número", "nit"],
["555", "1"],
],
path,
)
records = ExcelReader().read(str(path))
assert len(records) == 1
assert records[0].radicado == "555"