Metadata-Version: 2.4
Name: sis-scraper
Version: 1.0.8
Summary: Scraper para consultar el SIS
Home-page: https://github.com/userpro024/sis-scraper
Author: Alex Guillen
Author-email: payments539@gmail.com
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.31.0
Requires-Dist: beautifulsoup4>=4.12.0
Requires-Dist: urllib3>=2.0.0
Requires-Dist: lxml>=4.9.0
Requires-Dist: Pillow>=10.0.0
Requires-Dist: opencv-python>=4.8.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: onnxruntime>=1.15.0
Provides-Extra: anti-detection
Requires-Dist: fake-useragent>=1.4.0; extra == "anti-detection"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# SIS Scraper 🏥

Librería Python para consultas con anti-detección y caché.

## Características

- ✅ **Anti-detección**: User-Agent rotation, headers spoofing, delays aleatorios
- ✅ **Caché SQLite**: Guarda resultados por 1 año (configurable)
- ✅ **OCR automático**: Resuelve CAPTCHAs con ddddocr + OpenCV
- ✅ **Reintentos automáticos**: Si falla el captcha, reintenta

## 📦 Instalación

```bash
pip install sis-scraper
```

## Uso Rápido

### Forma Simple (Recomendada)

```python
from sis_scraper import consultar

resultado = consultar("12345678")

if resultado["exito"]:
    print(resultado["datos_personales"])
    print(resultado["afiliaciones"])
```

### Forma Avanzada (Control total)

```python
from sis_scraper import SisScraperAntiDeteccion

scraper = SisScraperAntiDeteccion(cache_horas=720)  # 30 días
resultado = scraper.consultar_con_reintentos("12345678", max_intentos=5)
```

## Uso como CLI

```bash
sis-scraper
```

## Estructura del Resultado

```json
{
  "exito": true,
  "mensaje": "Consulta exitosa",
  "datos_personales": {
    "nombre": "APELLIDO APELLIDO NOMBRE",
    "documento": "DNI 12345678",
    "afiliacion": "2-12345678",
    "tipo_asegurado": "TITULAR",
    "estado": "ACTIVO"
  },
  "afiliaciones": [
    {
      "Apellidos y Nombres": "...",
      "N° Doc.": "DNI 12345678",
      "N° Afiliación": "2-12345678",
      "Tipo de Asegurado": "TITULAR",
      "Estado": "ACTIVO",
      "campo_8": "SUBSIDIADO (SIS GRATUITO)",
      "campo_11": "25 / 07 / 2016",
      "campo_13": "C.S. CENTRO DE SALUD",
      "..."
    }
  ]
}
```

## Dependencias

Instaladas automáticamente:
- requests, beautifulsoup4, lxml
- opencv-python, Pillow, numpy
- onnxruntime (para OCR)

## Licencia

MIT
