Exemplo n.º 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()))
Exemplo n.º 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()))
Exemplo n.º 3
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://smlk.es/api/create/?destination=%s"
Exemplo n.º 4
0
 def __init__(self):
     GenericService.__init__(self)
     self.url = "http://goo.gl/api/url"
Exemplo n.º 5
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://u.nu/unu-api-simple?url=%s"
Exemplo n.º 6
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://smlk.es/api/create/?destination=%s"
Exemplo n.º 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)
Exemplo n.º 8
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://su.pr/api/simpleshorten?url=%s"
Exemplo n.º 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
Exemplo n.º 10
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://zi.ma/?module=ShortURL&file=Add&mode=API&url=%s"
Exemplo n.º 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'
Exemplo n.º 12
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://api.bit.ly/shorten?%s&%s&%s&longUrl=%s"
Exemplo n.º 13
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://is.gd/api.php?longurl=%s"
Exemplo n.º 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="(.*?)">')
Exemplo n.º 15
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://tr.im/api/trim_simple?url=%s"
Exemplo n.º 16
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://tr.im/api/trim_simple?url=%s"
Exemplo n.º 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="(.*?)">')
Exemplo n.º 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'
Exemplo n.º 19
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://u.nu/unu-api-simple?url=%s"
Exemplo n.º 20
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://cli.gs/api/v1/cligs/create?appid=gwibber&url=%s"
Exemplo n.º 21
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://tinyurl.com/api-create.php?url=%s"
Exemplo n.º 22
0
 def __init__(self):
     GenericService.__init__(self)
     self.log = logging.getLogger('Service')
     self.provider = 'https://api.twitter.com/1/account/verify_credentials.xml'
Exemplo n.º 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'
Exemplo n.º 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'
Exemplo n.º 25
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://is.gd/api.php?longurl=%s"
Exemplo n.º 26
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://cli.gs/api/v1/cligs/create?appid=gwibber&url=%s"
Exemplo n.º 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'
Exemplo n.º 28
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://zi.ma/?module=ShortURL&file=Add&mode=API&url=%s"
Exemplo n.º 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'
Exemplo n.º 30
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://tinyurl.com/api-create.php?url=%s"
Exemplo n.º 31
0
 def __init__(self):
     GenericService.__init__(self)
     self.log = logging.getLogger('Service')
     self.provider = 'https://api.twitter.com/1/account/verify_credentials.xml'
Exemplo n.º 32
0
 def __init__(self):
     GenericService.__init__(self)
     self.base = "http://su.pr/api/simpleshorten?url=%s"