Scraper para consultar datos del SIS de Perú con anti-detección y caché
Project description
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
# Desde el directorio del proyecto
pip install -e .
# O instalación normal
pip install .
Uso Rápido
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
# Si instalaste el paquete
sis-scraper
# O directamente
python -m sis_scraper.scraper
Configuración
# 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
{
"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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sis_scraper-1.0.0.tar.gz
(3.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sis_scraper-1.0.0.tar.gz.
File metadata
- Download URL: sis_scraper-1.0.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
643fae6ac82b7c6d3ccb4c6a6265c9613f7f59ea95a7dcc597044af1254c8c33
|
|
| MD5 |
10f1afb33b1b2010cebab66a11c31467
|
|
| BLAKE2b-256 |
803d17ced98f6424c5ce625b6b2e055d191ab2c49b8427fa7c557823a5638350
|
File details
Details for the file sis_scraper-1.0.0-py3-none-any.whl.
File metadata
- Download URL: sis_scraper-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8edccf7dfeeb14f631904b0e40d3dfaaaaf0282875163a1a2b8a30b291effe73
|
|
| MD5 |
e651cf96fc36f3a09603b0e3d038c72f
|
|
| BLAKE2b-256 |
b8ca76dcfa4fef1716394b6b25dce4bfee7f906b89a71d792a12373052efc66a
|