Skip to content

Instantly share code, notes, and snippets.

@eperedo
Created July 11, 2013 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eperedo/5977661 to your computer and use it in GitHub Desktop.
Save eperedo/5977661 to your computer and use it in GitHub Desktop.
Get congressman list
import urlfetch
from bs4 import BeautifulSoup
url = "http://www.congreso.gob.pe/organizacion/pleno.asp?mode=Pleno"
response = urlfetch.get(url)
htmlContent = response.content
soup = BeautifulSoup(htmlContent)
dumped = soup.find(id="frmPleno").findAll("table")[2].findAll("tr")
for item in dumped:
if item.find('a'):
print item.find('a')['href'].replace("FichaCongresista.asp?C_Persona=", "")
print item.find("a").get_text()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment