Skip to content

Instantly share code, notes, and snippets.

@marcelcaraciolo
Created February 23, 2012 17:38
Show Gist options
  • Save marcelcaraciolo/1893962 to your computer and use it in GitHub Desktop.
Save marcelcaraciolo/1893962 to your computer and use it in GitHub Desktop.
download.py
import mechanize
br = mechanize.Browser()
br.open("http://www.bmfbovespa.com.br/opcoes/opcoes.aspx?Idioma=pt-br")
br.select_form(nr=0)
# data/hora yyyy-mm-dd-hh-mm-ss
br["ctl00$contentPlaceHolderConteudo$posicoesAbertoEmp$txtConsultaDataDownload$txtConsultaDataDownload$dateInput"] = "2012-02-22-00-00-00"
response = br.submit(name='ctl00$contentPlaceHolderConteudo$posicoesAbertoEmp$btnBuscarArquivos')
f = open("teste.dat", "w")
f.write(response.read())
f.flush()
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment