Beispiel #1
0
    def POST(page):  # pylint: disable=invalid-name,missing-docstring

        if page == 'advanced':
            db_file = os.path.abspath(DB_NAME)
            data = from_post(web.data())
            manually_update_books(data, db_file)

        elif page == 'getshelves':
            _, _, api_key, _ = page_vars(web.data())
            defaults = Defaults('https://www.goodreads.com', api_key, None,
                                ['to-read'])
            shelves_xml = read_url(defaults.get_shelf_url())
            shelf_list = get_shelf_list(shelves_xml)
            web.header('Content-Type', 'application/json', unique=True)
            return json.dumps(shelf_list)

        return Admin.GET(page)
Beispiel #2
0
    def test_get_shelf_url(self):
        defaults = Defaults('http://FAKER.GLTD', 'FOO_KEY')

        assert defaults.get_shelf_url() == 'http://FAKER.GLTD/shelf/list.xml?key=FOO_KEY'