Skip to content

Instantly share code, notes, and snippets.

@jbovet
Last active May 7, 2026 07:41
Show Gist options
  • Select an option

  • Save jbovet/677f315d7fd434caceb5 to your computer and use it in GitHub Desktop.

Select an option

Save jbovet/677f315d7fd434caceb5 to your computer and use it in GitHub Desktop.
Consulta de estado de documento de identidad registro civil Chile
import requests,urllib3, sys
from bs4 import BeautifulSoup
if len(sys.argv) < 3:
print('Usage: python registrocivil.py run docType docNumber')
sys.exit('ex: python registrocivil.py 11111111-K CEDULA 10600000')
URL="https://portal.sidiv.registrocivil.cl/usuarios-portal/pages/DocumentRequestStatus.xhtml"
headers={"Content-Type":"application/x-www-form-urlencoded",
"User-Agent":"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"}
Run=sys.argv[1]
docType=sys.argv[2] #{CEDULA,CEDULA_EXT,PASAPORTE_PG,PASAPORTE_DIPLOMATICO,PASAPORTE_OFICIAL}
docNumber=sys.argv[3] #https://www.srcei.cl/PortalSIDIV/ayuda_documento.html
urllib3.disable_warnings()
s=requests.Session()
s.headers.update(headers)
r=s.get(URL, verify=False)
soup=BeautifulSoup(r.content,"html.parser")
viewState=soup.find(id="javax.faces.ViewState")['value']
data={"form":"form", "form:run":Run, "form:selectDocType":docType,
"form:docNumber":docNumber,"form:buttonHidden":"","javax.faces.ViewState":viewState}
r=s.post(URL, data=data)
soup=BeautifulSoup(r.content,"html.parser")
data = []
table = soup.find('table', attrs={'class':'tableResult'})
table_body = table.find('tbody')
print table_body
@DmACKGL
Copy link
Copy Markdown

DmACKGL commented Sep 25, 2022

Pusieron CloudFlare, alguien tiene la IP de origin guardada por ahi?

En Septiembre de 2022 funciona? Porque al ejecutarlo me sale esto:

Traceback (most recent call last):
  File "registrocivil.py", line 22, in <module>
    viewState=soup.find(id="javax.faces.ViewState")['value']
TypeError: 'NoneType' object has no attribute '__getitem__'

lo usé poniendo el número de RUN, después la palabra CEDULA y luego el número de serie de la cédula de identidad

El metodo ya no funciona debido a los Catpchas, arriba discutieron usar deathbycaptcha

@pnavarretec01
Copy link
Copy Markdown

les ha funcionado la opcion de usar deathbycaptcha?

@rafaincel
Copy link
Copy Markdown

rafaincel commented Dec 13, 2024

Impish Works tiene una API que entrega el estado de la cedula de identidad y pasaporte utilizando el RUN y el número de serie (vigente, no vigente, sin coincidencias). Ideal para autenticar a personas naturales.

https://regcivil.impish.top/

Transferencia bancaria, crypto, etc
Saludos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment