def __init__(self, url): data = urllib2.urlopen(url).read() self.etree = xml.etree.ElementTree.fromstring(data).find("./channel") self.rss_title = self.etree.find("./title").text.strip() # a little late... Book.__init__(self, "RSS: {title}".format(title=self.rss_title))
def __init__(self, url, username, password): self.username = username self.password = password self.server = xmlrpclib.ServerProxy(url).wp meta = self.server.getUsersBlogs(self.username, self.password)[0] self.blog_title = meta['blogName'] self.blog_id = meta['blogid'] Book.__init__(self, "Wordpress: {title}".format(title=self.blog_title))
def __init__(self, token, searchNotebook, count=50): self.client = EvernoteClient(token=token) self.noteStore = self.client.get_note_store() found = [] for notebook in self.noteStore.listNotebooks(): if searchNotebook in notebook.name: found.append(notebook) if len(found) < 1: raise IOError("Notebook not found.") elif len(found) > 1: raise IOError("%d notebooks match the criteria." % len(found)) self.notebook = found[0] Book.__init__(self, "Evernote: {title}".format( \ title=self.notebook.name)) self.count = count self.user = self.client.get_user_store().getUser()
def __init__(self, title, lang="en"): Book.__init__(self, u"Wikipedia: {title}".format(title=title)) wikipedia.set_lang(lang) self.page = wikipedia.page(title)