def run(self): while not self.exit: time.sleep(0.3) try: req = self.queue.get(False) except Queue.Empty: continue (args, callback) = req if args['cmd'] == 'download_pic': try: filename = GenericService._download_pic( self.imgdir, args['url']) self.log.debug('Descargada imagen de %s' % args['user']) callback(args['user'], filename) except Exception, error: self.log.debug("Error: %s\n%s" % (error, traceback.print_exc())) self.register(args, callback) elif args['cmd'] == 'short_url': self.log.debug('Cortando URL: %s' % args['url']) urlshorter = URL_SERVICES[args['service']] resp = urlshorter.do_service(args['url']) self.log.debug('URL Cortada: %s' % resp.response) callback(resp)
def run(self): while not self.exit: time.sleep(0.3) try: req = self.queue.get(False) except Queue.Empty: continue (args, callback) = req if args["cmd"] == "download_pic": try: filename = GenericService._download_pic(self.imgdir, args["url"]) self.log.debug("Descargada imagen de %s" % args["user"]) callback(args["user"], filename) except Exception, error: self.log.debug("Error: %s\n%s" % (error, traceback.print_exc())) self.register(args, callback) elif args["cmd"] == "short_url": self.log.debug("Cortando URL: %s" % args["url"]) urlshorter = URL_SERVICES[args["service"]] resp = urlshorter.do_service(args["url"]) self.log.debug("URL Cortada: %s" % resp.response) callback(resp)
def __init__(self): GenericService.__init__(self) self.base = "http://tr.im/api/trim_simple?url=%s"
def __init__(self): GenericService.__init__(self) self.base = "http://su.pr/api/simpleshorten?url=%s"
def __init__(self): GenericService.__init__(self) self.base = "http://tinyurl.com/api-create.php?url=%s"
def __init__(self): GenericService.__init__(self) self.base = "http://cli.gs/api/v1/cligs/create?appid=gwibber&url=%s"
def __init__(self): GenericService.__init__(self) self.base = "http://smlk.es/api/create/?destination=%s"
def __init__(self): GenericService.__init__(self) self.base = "http://zi.ma/?module=ShortURL&file=Add&mode=API&url=%s"
def __init__(self): GenericService.__init__(self) self.base = "http://api.bit.ly/shorten?%s&%s&%s&longUrl=%s"
def __init__(self): GenericService.__init__(self) self.server = "img.ly" self.base = "/api/upload"
def __init__(self): GenericService.__init__(self) self.base = "http://ur1.ca" self.pt = re.compile('<p class="success">Your ur1 is: <a href="(.*?)">')
def __init__(self): GenericService.__init__(self) self.server = "tweetphotoapi.com" self.base = "/api/upload.aspx"
def __init__(self): GenericService.__init__(self) self.base = "http://is.gd/api.php?longurl=%s"
def __init__(self): GenericService.__init__(self) self.server = "api.mobypicture.com" self.base = "/"
def __init__(self): GenericService.__init__(self) self.server = "twitpic.com" self.base = "/api/upload"
def __init__(self): GenericService.__init__(self) self.base = "http://ur1.ca" self.pt = re.compile( '<p class="success">Your ur1 is: <a href="(.*?)">')
def __init__(self): GenericService.__init__(self) self.server = "yfrog.com" self.base = "/api/upload"
def __init__(self): GenericService.__init__(self) self.base = "http://u.nu/unu-api-simple?url=%s"