se cambia el uso de google chrome por firefox para que se pueda utlizar en macpro late 2013
This commit is contained in:
1 parent
1c39f6f45f
commit
99a587c4da
10 files changed
+48
-40
No files matched your search
+4
-4
@@ -3,7 +3,7 @@
|
||||
## systemd (Linux)
|
||||
|
||||
### Requisitos adicionales
|
||||
- **Google Chrome** instalado (para `get_token_headless.py`)
|
||||
- **Mozilla Firefox** instalado (para `get_token_headless.py`)
|
||||
- **rsync** y **cifs-utils** (para montar SMB y sincronizar)
|
||||
|
||||
### Servicio
|
||||
@@ -34,7 +34,7 @@ sudo systemctl start sunat-cpe
|
||||
## NSSM (Windows)
|
||||
|
||||
### Requisitos
|
||||
- **Google Chrome** instalado (cualquier versión) — necesario para `get_token_headless.py`
|
||||
- **Mozilla Firefox** instalado (cualquier versión) — necesario para `get_token_headless.py`
|
||||
- Python 3.12+ con dependencias instaladas
|
||||
- **Unidad de red mapeable** (SMB) para sincronizar descargas
|
||||
|
||||
@@ -60,7 +60,7 @@ nssm start SUNAT-CPE
|
||||
NSSM redirige stdout/stderr a `C:\ruta\descarga_xml_sunat\logs\` por defecto (el logger del daemon también escribe allí).
|
||||
|
||||
### Renovación de token
|
||||
Como servicio, el daemon usa `get_token_headless()` (headless, Chrome real) para renovar el token automáticamente sin intervención. Si Chrome no está instalado, el daemon lo detecta y usa `get_token.py headless=False` como respaldo (requiere escritorio). Para renovar manualmente:
|
||||
Como servicio, el daemon usa `get_token_headless()` (headless, Firefox real) para renovar el token automáticamente sin intervención. Si Firefox no está instalado, el daemon lo detecta y usa `get_token.py headless=False` como respaldo (requiere escritorio). Para renovar manualmente:
|
||||
|
||||
```cmd
|
||||
C:\ruta\descarga_xml_sunat\sunat-env\Scripts\python get_token.py
|
||||
@@ -77,7 +77,7 @@ nssm start SUNAT-CPE
|
||||
|
||||
```dockerfile
|
||||
FROM python:3.12-slim
|
||||
RUN pip install -r requirements.txt && playwright install chromium
|
||||
RUN pip install -r requirements.txt && playwright install firefox
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
CMD ["python", "main.py"]
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ flowchart TD
|
||||
B -->|No| C["Esperar"]
|
||||
C --> B
|
||||
B -->|Sí| D["Token válido?"]
|
||||
D -->|No| E["get_token_headless()<br>channel=chrome headless=True<br>→ get_token.py headless=False"]
|
||||
D -->|No| E["get_token_headless()<br>headless=True<br>→ get_token.py headless=False"]
|
||||
E --> F["token.json"]
|
||||
D -->|Sí| F
|
||||
end
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
| Archivo | Función |
|
||||
|---|---|
|
||||
| `main.py` | Daemon orquestador. Bucle infinito con horarios configurables, obtiene token, consulta HANA, procesa pendientes (nuevos + reintentos). |
|
||||
| `get_token_headless.py` | Login headless via Chrome real (`channel="chrome"`). Sin ventana visible. |
|
||||
| `get_token_headless.py` | Login headless via Firefox real. Sin ventana visible. |
|
||||
| `get_token.py` | Login SOL via Playwright (headless=False). Navega menú → extrae JWT de `sessionStorage['SUNAT.token']`. |
|
||||
| `consulta_cpe.py` | Consulta API REST `api-cpe.sunat.gob.pe`. Retorna `(data, status_code)`. Lanza `TokenExpiredError` en 401. |
|
||||
| `hana_manager.py` | Conexión HANA vía `hdbcli`. Consulta pendientes en `OPCH`, actualiza flags de descarga. |
|
||||
|
||||
+4
-4
@@ -3,9 +3,9 @@
|
||||
## Requisitos
|
||||
|
||||
- Python 3.10+
|
||||
- Playwright (chromium)
|
||||
- Playwright (firefox)
|
||||
- Acceso a HANA (hdbcli)
|
||||
- **Google Chrome** (para `get_token_headless.py`)
|
||||
- **Mozilla Firefox** (para `get_token_headless.py`)
|
||||
- **rsync** (Mac/Linux) o **net use** (Windows) para SMB
|
||||
|
||||
## Instalación
|
||||
@@ -17,7 +17,7 @@ source sunat-env/bin/activate
|
||||
|
||||
# Instalar dependencias
|
||||
pip install -r requirements.txt
|
||||
playwright install chromium
|
||||
playwright install firefox
|
||||
```
|
||||
|
||||
## Variables de Entorno (`.env`)
|
||||
@@ -55,7 +55,7 @@ source sunat-env/bin/activate
|
||||
# Obtener token manualmente (con navegador visible)
|
||||
python get_token.py
|
||||
|
||||
# Obtener token headless (sin ventana, requiere Chrome real)
|
||||
# Obtener token headless (sin ventana, requiere Firefox real)
|
||||
python get_token_headless.py
|
||||
|
||||
# Daemon completo (automático)
|
||||
|
||||
Reference in new issue
Block a user