7 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
Stijn Van Campenhout
29d113f3af Added release workflow 2020-11-13 08:16:08 +01:00
ruebeckscube
433eb8e722 Change Collection.items to instance variable (#8)
fix: Change Collection.items to instance variable
2020-11-13 08:10:39 +01:00
Stijn Van Campenhout
7ceac42fdb Merge branch 'bsdz-patch-1' 2020-11-12 16:31:17 +01:00
6 changed files with 46 additions and 10 deletions

31
.github/workflows/python-publish.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Upload Python Package
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*

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

@@ -15,9 +15,9 @@ class Collection(object):
items: A list containing the items.
"""
items: List[DocumentOrFolder] = []
def __init__(self, *items: List[DocumentOrFolder]):
self.items: List[DocumentOrFolder] = []
for i in items:
self.items.append(i)

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: