Last active
March 22, 2024 16:41
-
-
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 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 |
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
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?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Certificadora del Sur tiene una API que entrega el estado del carné de identidad ingresando el RUT y el numero de serie para carnés nuevos y antiguos.
Contactar a 996351067.
Saludos