Metadata-Version: 2.4
Name: sis-scraper
Version: 1.0.5
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
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

```bash
# Instalación desde PyPI (Recomendado)
pip install sis-scraper

# Instalación local (Desarrollo)
pip install -e .
```

## 📦 Instalación

### Opción 1: Desde GitHub (Recomendado)

```bash
pip install git+https://github.com/tu-usuario/sis-scraper.git
```
*(Nota: Incluye automáticamente `ddddocr` parcheado para evitar errores).*

### Opción 2: Desarrollo Local


## 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
