class TwitterManager(Singleton, Client, TerraObject): terra_type = "Manager/Twitter" def __init__(self): Singleton.__init__(self) Client.__init__(self) self.twitpic_client = TwitPicClient() def uploadToTwitpicAndPostToTwitter(self, filename, imagedata, message): username = self.getUserName() password = self.getPassWord() selector = '/api/uploadAndPost' fields = [('username', username),('password', password),('message',message)] files = [('media',filename,imagedata)] response = self.twitpic_client.post_multipart(fields,files, selector) status = utils.getStatusFromTwitpicResponse(response) return status def uploadToTwitpic(self, filename, imagedata, message): username = self.getUserName() password = self.getPassWord() selector = '/api/upload' fields = [('username', username),('password', password),('message',message)] files = [('media',filename,imagedata)] response = self.twitpic_client.post_multipart(fields,files, selector) status = utils.getStatusFromTwitpicResponse(response) return status
def __init__(self): Singleton.__init__(self) Client.__init__(self) self.twitpic_client = TwitPicClient()