Esempio n. 1
0
    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)
Esempio n. 2
0
    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)
Esempio n. 3
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://tr.im/api/trim_simple?url=%s"
Esempio n. 4
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://su.pr/api/simpleshorten?url=%s"
Esempio n. 5
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://tinyurl.com/api-create.php?url=%s"
Esempio n. 6
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://cli.gs/api/v1/cligs/create?appid=gwibber&url=%s"
Esempio n. 7
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://smlk.es/api/create/?destination=%s"
Esempio n. 8
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://zi.ma/?module=ShortURL&file=Add&mode=API&url=%s"
Esempio n. 9
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://api.bit.ly/shorten?%s&%s&%s&longUrl=%s"
Esempio n. 10
0
 def __init__(self):
     GenericService.__init__(self)
     self.server = "img.ly"
     self.base = "/api/upload"
Esempio n. 11
0
 def __init__(self):
     GenericService.__init__(self)
     self.server = "img.ly"
     self.base = "/api/upload"
Esempio n. 12
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://ur1.ca"
     self.pt = re.compile('<p class="success">Your ur1 is: <a href="(.*?)">')
Esempio n. 13
0
 def __init__(self):
     GenericService.__init__(self)
     self.server = "tweetphotoapi.com"
     self.base = "/api/upload.aspx"
Esempio n. 14
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://is.gd/api.php?longurl=%s"
Esempio n. 15
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://cli.gs/api/v1/cligs/create?appid=gwibber&url=%s"
Esempio n. 16
0
 def __init__(self):
     GenericService.__init__(self)
     self.server = "api.mobypicture.com"
     self.base = "/"
Esempio n. 17
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://api.bit.ly/shorten?%s&%s&%s&longUrl=%s"
Esempio n. 18
0
 def __init__(self):
     GenericService.__init__(self)
     self.server = "twitpic.com"
     self.base = "/api/upload"
Esempio n. 19
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://ur1.ca"
     self.pt = re.compile(
         '<p class="success">Your ur1 is: <a href="(.*?)">')
Esempio n. 20
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://smlk.es/api/create/?destination=%s"
Esempio n. 21
0
 def __init__(self):
     GenericService.__init__(self)
     self.server = "yfrog.com"
     self.base = "/api/upload"
Esempio n. 22
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://tr.im/api/trim_simple?url=%s"
Esempio n. 23
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://u.nu/unu-api-simple?url=%s"