Created
May 30, 2017 17:35
-
-
Save wallacemaxters/39950a8843985691805da9cac84c36f6 to your computer and use it in GitHub Desktop.
Pequeno programa escrito em Python pra fazer download via linha de comando.
This file contains 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/python | |
# -*- coding: utf-8 -*- | |
import urllib2 | |
def open_url(url): | |
return urllib2.urlopen(url).read() | |
if __name__ == '__main__': | |
import sys | |
try: | |
result = open_url(sys.argv[1]) | |
except KeyboardInterrupt: | |
print ("\nCancelado pelo usuário\n") | |
sys.exit(1) | |
print (result) | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exemplo de uso: