Skip to content

Instantly share code, notes, and snippets.

@wallacemaxters
Created May 30, 2017 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wallacemaxters/39950a8843985691805da9cac84c36f6 to your computer and use it in GitHub Desktop.
Save wallacemaxters/39950a8843985691805da9cac84c36f6 to your computer and use it in GitHub Desktop.
Pequeno programa escrito em Python pra fazer download via linha de comando.
#!/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)
@wallacemaxters
Copy link
Author

Exemplo de uso:

$ ./wget.py http://pt.stackoverflow.com.br

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment