Last active
December 13, 2024 19:43
-
-
Save jbovet/677f315d7fd434caceb5 to your computer and use it in GitHub Desktop.
Consulta de estado de documento de identidad registro civil Chile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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
les ha funcionado la opcion de usar deathbycaptcha?
Impish Works tiene una API que entrega el estado del carné de identidad utilizando RUT y el numero de serie. También para pasaportes y su numero de serie. 5 pesos por consulta.
Contactar [email protected]. Transferencia bancaria, crypto, etc
Saludos
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
En Septiembre de 2022 funciona? Porque al ejecutarlo me sale esto:
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