Skip to content

Instantly share code, notes, and snippets.

@zuhrig
Last active October 8, 2018 15:47
Show Gist options
  • Save zuhrig/7f05bf6d342438da9ee9cbea0ef74da7 to your computer and use it in GitHub Desktop.
Save zuhrig/7f05bf6d342438da9ee9cbea0ef74da7 to your computer and use it in GitHub Desktop.
import urllib2
from bs4 import BeautifulSoup
numero_expediente = 61333
url = "http://www.concejodeliberante.laplata.gov.ar/MesaEntradas/expediente.asp?Numero={}&Buscar=Enviar".format(numero_expediente)
page = urllib2.urlopen(url)
soup = BeautifulSoup(page, 'html.parser')
expediente = {
"id": [text for text in soup.table.find_all('tr')[0].find_all('li')[0].stripped_strings][1],
"started": [text for text in soup.table.find_all('tr')[0].find_all('li')[1].stripped_strings][1],
"started_date": [text for text in soup.table.find_all('tr')[0].find_all('li')[2].stripped_strings][1],
"presentation_type": [text for text in soup.table.find_all('tr')[0].find_all('li')[3].stripped_strings][1],
"detail": [text for text in soup.table.find_all('tr')[0].find_all('li')[4].stripped_strings][1],
"status": [text for text in soup.table.find_all('tr')[1].find_all('li')[0].stripped_strings][1],
"last_update": soup.table.find_all('tr')[1].find_all('li')[1].get_text().split(':')[1].replace(u'\xa0',''),
"resolution_id": soup.table.find_all('tr')[1].find_all('li')[2].get_text().split(':')[1].replace(u'\xa0','').replace(u'\xb0','')
}
print(expediente)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment