wallabag_api icon indicating copy to clipboard operation
wallabag_api copied to clipboard

error with mobi export

Open jpcaruana opened this issue 6 years ago • 1 comments

Hi,

great job for your API.

I tried your example script but changed the pdf extension to mobi (since I want to send this to a kindle)

I had the following error:

aiohttp.client_exceptions.ClientResponseError: 0, message='Attempt to decode JSON with unexpected mimetype: application/x-mobipocket-ebook'

Any idea ? Merci

jpcaruana avatar Sep 19 '17 15:09 jpcaruana

Hi, I have 2 assumptions:

1 - may be your wallabag instance is not uptodate (2.2.3 ) ? (and are you able to export article in mobi from your wallabag instance ?) 2 - if it's already up2date, try

pip install wallabag_api==1.1.0

thus you will rollback to the use of requests instead aiohttp.

Then add the missing method that I added to 1.1.0 in this file:

vim /path/to/your/lib/python3.6/site-packages/wallabag_api/wallabag.py
    def get_entry_export(self, entry):
        """
        GET /api/entries/{entry}/export.{_format}
        Retrieve a single entry as a predefined format.
        :param entry: \w+ an integer The Entry ID
        :return data related to the ext
        """
        params = {'access_token': self.token}
        url = '/api/entries/{entry}/export.{ext}'.format(entry=entry,
                                                         ext=self.format)
    return self.query(url, "get", **params)

if the same of https://github.com/foxmask/wallabag_api/blob/master/wallabag_api/wallabag.py#L274-L286 without "async/await"

I that fix the problem, let me know, I will rollback all the lib to requests too.

foxmask avatar Sep 19 '17 16:09 foxmask