Esempio n. 1
0
def init():
    # Read credentials from Credentials.ini file
    configParser = ConfigParser.RawConfigParser()
    configParser.read('Credentials.ini')

    key = configParser.get('Instapaper', 'INSTAPAPER_KEY')
    secret = configParser.get('Instapaper', 'INSTAPAPER_SECRET')
    login = configParser.get('Login', 'INSTAPAPER_LOGIN')
    password = configParser.get('Login', 'INSTAPAPER_PASSWORD')

    # Create instance of Instapaper using the OAth credentials
    instapaper = Instapaper(key, secret)

    # Login with user and password
    instapaper.login(login, password)

    return instapaper
Esempio n. 2
0
    def generate_output(self, writer):
        # Using https://github.com/rsgalloway/instapaper
        # Alternatives:
        # - https://github.com/mrtazz/InstapaperLibrary
        # - https://github.com/mdorn/pyinstapaper
        from instapaper import Instapaper

        try:
            ip = Instapaper(self.settings["INSTAPAPER_KEY"],
                            self.settings["INSTAPAPER_SECRET"])
            ip.login(self.settings["INSTAPAPER_USER"],
                     self.settings["INSTAPAPER_PASSWORD"])

            # DEBUG simply print the list of folders
            content = repr(ip.folders())

            # TODO retrieve the contents of the 'archive' folders
            # TODO sort and group bookmarks
            # TODO format bookmarks
        except Exception:
            return

        template = self.get_template("page")

        page = {
            "title": "Instapaper",
            "content": content,
        }

        writer.write_file(
            "instapaper_list.html",
            template,
            self.context,
            page=page,
            relative_urls=self.settings["RELATIVE_URLS"],
        )
    def index(self, conf):
        i = Instapaper(conf['instapaper_key'], conf['instapaper_secret'])
        i.login(conf['username'], conf['password'])

        for bookmark in i.bookmarks(limit=99999):
            yield InstapaperBookmark(bookmark)