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()))
def __init__(self): GenericService.__init__(self) self.base = "http://smlk.es/api/create/?destination=%s"
def __init__(self): GenericService.__init__(self) self.url = "http://goo.gl/api/url"
def __init__(self): GenericService.__init__(self) self.base = "http://u.nu/unu-api-simple?url=%s"
#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)
def __init__(self): GenericService.__init__(self) self.base = "http://su.pr/api/simpleshorten?url=%s"
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
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.server = "api.imgur.com" self.base = "/2/upload.json" self.provider = 'https://api.twitter.com/1/account/verify_credentials.xml'
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.base = "http://is.gd/api.php?longurl=%s"
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.base = "http://tr.im/api/trim_simple?url=%s"
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/xauth_upload" self.provider = 'https://api.twitter.com/1/account/verify_credentials.xml'
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://tinyurl.com/api-create.php?url=%s"
def __init__(self): GenericService.__init__(self) self.log = logging.getLogger('Service') self.provider = 'https://api.twitter.com/1/account/verify_credentials.xml'
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'
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'
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'