Exemple #1
0
 def run(self):
     while not self.exit:
         try:
             req = self.queue.get(True, 0.3)
         except Queue.Empty:
             continue
         except:
             continue
         
         (args, callback) = req
         
         if self.exit:
             self.queue.task_done()
             break
             
         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 urllib2.URLError, error:
                 self.log.debug("Error: %s\n%s" % (error, 
                     traceback.print_exc()))
                 #FIXME
                 #self.register(args, callback)
             except Exception, error:
                 self.log.debug("Error: %s\n%s" % (error, 
                     traceback.print_exc()))
Exemple #2
0
 def run(self):
     while not self.exit:
         try:
             req = self.queue.get(True, 0.3)
         except Queue.Empty:
             continue
         except:
             continue
         
         (args, callback) = req
         
         if self.exit:
             self.queue.task_done()
             break
             
         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 urllib2.URLError, error:
                 self.log.debug("Error: %s\n%s" % (error, 
                     traceback.print_exc()))
                 #FIXME
                 #self.register(args, callback)
             except Exception, error:
                 self.log.debug("Error: %s\n%s" % (error, 
                     traceback.print_exc()))
Exemple #3
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://smlk.es/api/create/?destination=%s"
Exemple #4
0
 def __init__(self):
     GenericService.__init__(self)
     self.url = "http://goo.gl/api/url"
Exemple #5
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://u.nu/unu-api-simple?url=%s"
Exemple #6
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://smlk.es/api/create/?destination=%s"
Exemple #7
0
         #FIXME
         #self.register(args, callback)
     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)
 elif args['cmd'] == 'expand_url':
     self.log.debug('Expand URL: %s' % args['url'])
     try:
         expanded = GenericService._expand_url(args['url'])
         callback(expanded)
     except Exception, error:
         self.log.debug("Failed to expand url: %s" % error)
         callback(args['url'])
 elif args['cmd'] == 'upload_pic':
     self.log.debug('Subiendo imagen [%s]: %s' % 
                    (args['service'], args['path']))
     if args['service']:
         uploader = PHOTO_SERVICES[args['service']]
         resp = uploader.do_service(self.username, self.password, 
             args['path'], args['message'], self.httpobj)
     else:
         resp = ServiceResponse(err=True, 
             err_msg=_('Select a service for upload pics'))
     callback(resp)
Exemple #8
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://su.pr/api/simpleshorten?url=%s"
Exemple #9
0
 def __init__(self, domain='bit.ly'):
     GenericService.__init__(self)
     self.base = 'http://api.bitly.com/v3/shorten?domain=%s' % domain # shorten?%s&%s&%s&longUrl=%s&domain=" + domain
Exemple #10
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://zi.ma/?module=ShortURL&file=Add&mode=API&url=%s"
Exemple #11
0
 def __init__(self):
     GenericService.__init__(self)
     self.server = "api.imgur.com"
     self.base = "/2/upload.json"
     self.provider = 'https://api.twitter.com/1/account/verify_credentials.xml'
Exemple #12
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://api.bit.ly/shorten?%s&%s&%s&longUrl=%s"
Exemple #13
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://is.gd/api.php?longurl=%s"
Exemple #14
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://ur1.ca"
     self.pt = re.compile(
         '<p class="success">Your ur1 is: <a href="(.*?)">')
Exemple #15
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://tr.im/api/trim_simple?url=%s"
Exemple #16
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://tr.im/api/trim_simple?url=%s"
Exemple #17
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://ur1.ca"
     self.pt = re.compile('<p class="success">Your ur1 is: <a href="(.*?)">')
Exemple #18
0
 def __init__(self):
     GenericService.__init__(self)
     self.server = "yfrog.com"
     self.base = "/api/xauth_upload"
     self.provider = 'https://api.twitter.com/1/account/verify_credentials.xml'
Exemple #19
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://u.nu/unu-api-simple?url=%s"
Exemple #20
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://cli.gs/api/v1/cligs/create?appid=gwibber&url=%s"
Exemple #21
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://tinyurl.com/api-create.php?url=%s"
Exemple #22
0
 def __init__(self):
     GenericService.__init__(self)
     self.log = logging.getLogger('Service')
     self.provider = 'https://api.twitter.com/1/account/verify_credentials.xml'
Exemple #23
0
 def __init__(self):
     GenericService.__init__(self)
     self.server = "yfrog.com"
     self.base = "/api/xauth_upload"
     self.provider = 'https://api.twitter.com/1/account/verify_credentials.xml'
Exemple #24
0
 def __init__(self):
     GenericService.__init__(self)
     self.server = "posterous.com"
     self.base = "/api2/upload.xml"
     self.provider = 'https://api.twitter.com/1/account/verify_credentials.json'
Exemple #25
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://is.gd/api.php?longurl=%s"
Exemple #26
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://cli.gs/api/v1/cligs/create?appid=gwibber&url=%s"
Exemple #27
0
 def __init__(self):
     GenericService.__init__(self)
     self.server = "img.ly"
     self.base = "/api/2/upload.xml"
     self.provider = 'https://api.twitter.com/1/account/verify_credentials.json'
Exemple #28
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://zi.ma/?module=ShortURL&file=Add&mode=API&url=%s"
Exemple #29
0
 def __init__(self):
     GenericService.__init__(self)
     self.server = "api.mobypicture.com"
     self.base = "/2.0/upload.xml"
     self.provider = 'https://api.twitter.com/1/account/verify_credentials.json'
Exemple #30
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://tinyurl.com/api-create.php?url=%s"
Exemple #31
0
 def __init__(self):
     GenericService.__init__(self)
     self.log = logging.getLogger('Service')
     self.provider = 'https://api.twitter.com/1/account/verify_credentials.xml'
Exemple #32
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://su.pr/api/simpleshorten?url=%s"