Skip to content

Instantly share code, notes, and snippets.

@gileno
Created February 23, 2012 18:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gileno/1894168 to your computer and use it in GitHub Desktop.
Save gileno/1894168 to your computer and use it in GitHub Desktop.
usando mechanize
# -*- coding: utf-8 -*-
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