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 PyPI (Recomendado)
pip install sis-scraper
# Instalación local (Desarrollo)
pip install -e .
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.1.tar.gz
(4.0 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.1.tar.gz.
File metadata
- Download URL: sis_scraper-1.0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e01ddd7163c395918c933ff8dbc9fe915c2f2f14b73091835edd626ead42504a
|
|
| MD5 |
643bce5e44056a99c8af615c3b276c3c
|
|
| BLAKE2b-256 |
391e167572b4cb2a6cdd4c69a50ceba4b7d8e57e342399142b5abe9fdf850499
|
File details
Details for the file sis_scraper-1.0.1-py3-none-any.whl.
File metadata
- Download URL: sis_scraper-1.0.1-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 |
6a4e6175e24b4aff259f8ac61dfadbd89bdc7f8e99d90afcfac1fff93ab96ebf
|
|
| MD5 |
b282065fdfcabb2fc9bc98094a56bc23
|
|
| BLAKE2b-256 |
0eda7f934e67bda768c4f0940c51f5ecdadc45b8580a4471c385e66c619b4d6b
|