Skip to content

Instantly share code, notes, and snippets.

@ramayac
Created September 13, 2011 21:35
Show Gist options
  • Save ramayac/1215235 to your computer and use it in GitHub Desktop.
Save ramayac/1215235 to your computer and use it in GitHub Desktop.
Obtiene un cachimbo de imagenes con el captcha de Digicel.
import time
from urllib import urlopen
from urllib import urlretrieve
import os
import sys
import hashlib
from threading import Thread
class worker(Thread):
out_folder = os.path.abspath(os.curdir) + "/test"
hashing = hashlib.sha1()
def run(self):
while True:
url = "http://actualiza.digicel.com.sv/captcha.ashx"
worker.hashing.update(str(time.time()))
filename = "captcha" + worker.hashing.hexdigest()[:10] + ".png"
outpath = os.path.join(worker.out_folder, filename)
urlretrieve(url, outpath)
time.sleep(1)
if __name__ == "__main__":
worker().start()
worker().start()
worker().start()
worker().start()
worker().start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment