Skip to main content

Scraper para consultar el SIS

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

pip install sis-scraper

Uso Rápido

Consulta Simple

from sis_scraper import dni

resultado = dni("12345678")

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

Consulta Masiva

from sis_scraper import dni_varios

lista = ["12345678", "87654321", "11111111"]
resultados = dni_varios(lista)

for r in resultados:
    if r["exito"]:
        print(f"✅ {r['datos_personales']['nombre']}")
    else:
        print(f"❌ {r['dni_consultado']}: {r['mensaje']}")

Forma Avanzada (Control total)

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

sis-scraper

Estructura del Resultado

{
  "exito": true,
  "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

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.9.tar.gz (76.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sis_scraper-1.0.9-py3-none-any.whl (76.2 MB view details)

Uploaded Python 3

File details

Details for the file sis_scraper-1.0.9.tar.gz.

File metadata

  • Download URL: sis_scraper-1.0.9.tar.gz
  • Upload date:
  • Size: 76.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for sis_scraper-1.0.9.tar.gz
Algorithm Hash digest
SHA256 e74833b7b12be53fc40333b027964a243f225d42ad9019a28523c861b6a16fe6
MD5 3a603b710583b481a6879999b46ba52d
BLAKE2b-256 d0bb2f3264ae63f3a044d18c9090839587390999087c6aedbd190c509da46a35

See more details on using hashes here.

File details

Details for the file sis_scraper-1.0.9-py3-none-any.whl.

File metadata

  • Download URL: sis_scraper-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 76.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for sis_scraper-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 bbb886026867a0b84c021988269d62173130cc8e2d87861c2a660f03bd206bb5
MD5 bb437336c76b176ff83b7a1db8acf0ca
BLAKE2b-256 5ac353a86286a102c4621ceaffb5173e4bc518e76318948559471f67cf74bf5d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page