4 Commits

Author SHA1 Message Date
Stijn Van Campenhout
b5f0367dbb Updated version number 2021-01-30 18:02:43 +01:00
Stijn Van Campenhout
bc36d7b7c6 Updated to latest release 2021-01-30 17:50:49 +01:00
Adeel Khan
15d8090e79 doc: change refresh to renew (#11) 2021-01-30 14:46:21 +01:00
Jacob Kaplan-Moss
8bb29e3bd7 fix(download): Ignore missing thumbnail files (#9)
* Ignore missing thumbnail files

* Change logger name
2021-01-30 14:35:32 +01:00
4 changed files with 13 additions and 8 deletions

View File

@@ -14,4 +14,3 @@ This is an (unofficial) Remarkable Cloud API Client written in Python.
* ❎ cli interface
* ❎ export pdf with annotations

View File

@@ -31,9 +31,9 @@ and use the code you see on the webpage
# stored in the users directory in the file ~/.rmapi, the same as with the
# go rmapi client.
rmapy.register_device("fkgzzklrs")
# It's always a good idea to refresh the user token every time you start
# It's always a good idea to renew the user token every time you start
# a new session.
rmapy.refresh_token()
rmapy.renew_token()
# Should return True
rmapy.is_auth()

View File

@@ -5,9 +5,11 @@ import shutil
from uuid import uuid4
import json
from typing import TypeVar, List, Tuple
from logging import getLogger
from requests import Response
from .meta import Meta
log = getLogger("rmapy")
BytesOrString = TypeVar("BytesOrString", BytesIO, str)
@@ -311,7 +313,6 @@ class ZipDocument(object):
pass
# Get the RM pages
pages = [x for x in zf.namelist()
if x.startswith(f"{self.ID}/") and x.endswith('.rm')]
for p in pages:
@@ -322,11 +323,16 @@ class ZipDocument(object):
page.seek(0)
with zf.open(p.replace(".rm", "-metadata.json"), 'r') as md:
metadata = json.load(md)
thumbnail_name = p.replace(".rm", ".jpg")
thumbnail_name = thumbnail_name.replace("/", ".thumbnails/")
with zf.open(thumbnail_name, 'r') as tn:
thumbnail = BytesIO(tn.read())
thumbnail.seek(0)
try:
with zf.open(thumbnail_name, 'r') as tn:
thumbnail = BytesIO(tn.read())
thumbnail.seek(0)
except KeyError:
log.debug(f"missing thumbnail: {thumbnail_name}")
thumbnail = None
self.rm.append(RmPage(page, metadata, page_number, thumbnail,
self.ID))

View File

@@ -37,7 +37,7 @@ setup(
# For a discussion on single-sourcing the version across setup.py and the
# project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='0.2.2', # Required
version='0.2.3', # Required
# This is a one-line description or tagline of what your project does. This
# corresponds to the "Summary" metadata field: