Metadata-Version: 2.4
Name: sis-scraper
Version: 1.0.0
Summary: Scraper para consultar datos del SIS de Perú con anti-detección y caché
Home-page: https://github.com/userpro024/sis-scraper
Author: Alex Guillen
Author-email: Alex Guillen <payments539@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/tu-usuario/sis-scraper
Project-URL: Documentation, https://github.com/tu-usuario/sis-scraper#readme
Project-URL: Repository, https://github.com/tu-usuario/sis-scraper.git
Project-URL: Issues, https://github.com/tu-usuario/sis-scraper/issues
Keywords: sis,scraper,peru,salud,seguro
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# 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
# Desde el directorio del proyecto
pip install -e .

# O instalación normal
pip install .
```

## Uso Rápido

```python
from sis_scraper import SisScraperAntiDeteccion

# Crear scraper
scraper = SisScraperAntiDeteccion()

# Consultar DNI (con reintentos automáticos)
resultado = scraper.consultar_con_reintentos("12345678")

if resultado["exito"]:
    print(f"Nombre: {resultado['datos_personales']['nombre']}")
    print(f"Estado: {resultado['datos_personales']['estado']}")
```

## Uso como CLI

```bash
# Si instalaste el paquete
sis-scraper

# O directamente
python -m sis_scraper.scraper
```

## Configuración

```python
# Cambiar duración del caché (en horas)
scraper = SisScraperAntiDeteccion(cache_horas=720)  # 30 días

# Cambiar ubicación de la base de datos
scraper = SisScraperAntiDeteccion(db_path="/ruta/mi_cache.db")
```

## 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": [...]
}
```

## Dependencias

- requests
- beautifulsoup4
- ddddocr
- opencv-python
- Pillow
- lxml
- fake-useragent (opcional)

## Licencia

MIT
