Skip to content

Instantly share code, notes, and snippets.

@batok
Created November 12, 2010 02:17
Show Gist options
  • Save batok/673625 to your computer and use it in GitHub Desktop.
Save batok/673625 to your computer and use it in GitHub Desktop.
def paridad_dolar_dof(dia, mes, year ):
from BeautifulSoup import BeautifulSoup
from urllib2 import urlopen
url = "http://dof.gob.mx/indicadores_detalle.php?cod_tipo_indicador=158&dfecha={0:02d}%2F{1:02d}%2F{2}&hfecha={0:02d}%2F{1:02d}%2F{2}".format( dia, mes, year)
contents = urlopen(url).read()
soup = BeautifulSoup( contents )
first = soup.find("tr", "Celda 1 ")
second = first.findAll("td")
return second[-1].renderContents()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment