Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- """
- Implementation test of wimple wget in Python
- For proxy use: http_proxy e no_proxy environment variables.
- """
- from urllib import urlretrieve
- import sys
- import os
- def reporthook(vez,pedaco,total):
- total_vezes = (total/pedaco)
- porcento = (vez * 100) / total_vezes
- if porcento % 10 == 0:
- print "%d%%" % porcento,
- if __name__=="__main__":
- if len(sys.argv) <= 1:
- sys.stderr.write("Informe uma url para download: ./wget.py <url> ")
- exit(-1)
- print "Inciando download de:", sys.argv[1]
- urlretrieve(sys.argv[1], sys.argv[1].split(os.altsep)[-1:][0], reporthook)
- print "Concluido"
Add Comment
Please, Sign In to add comment