Created
August 29, 2014 14:49
-
-
Save gabrielcesar/52717109f067c3402915 to your computer and use it in GitHub Desktop.
Using wget over Python.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
20140829 | |
Uso: | |
Na variavel file insira o arquivo a ser baixado com URL completa. | |
Lembrando que o sitio, `caixa.gov.br' faz controle de downloads por IP. | |
Espero ter colaborado. | |
[email protected] | |
''' | |
import os | |
accept = 'Accept: text/html' | |
user_agent = 'Mozilla/5.0 ( Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0' | |
file = 'http://www1.caixa.gov.br/loterias/_arquivos/loterias/D_lotfac.zip' | |
command = 'wget -c --header="%s" --user-agent="%s" %s' % ( accept, user_agent, file ) | |
os.system ( command ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ainda tem como fazer este código funcionar? Toda forma q eu tento da erro 404