From ec8b9e608544732e7ebe3c0f203d34e81174c605 Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 15 May 2020 09:52:22 +0200 Subject: [PATCH] rmapy first time setup --- bin/sync_zotero_rm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/sync_zotero_rm b/bin/sync_zotero_rm index 20375c4..8f4ff32 100644 --- a/bin/sync_zotero_rm +++ b/bin/sync_zotero_rm @@ -11,12 +11,24 @@ from rmapy.folder import Folder from rmapy.document import Document from rmapy.document import ZipDocument from sync_zotero_rm.config import get_config + +# remarkable client setup +def get_rmapy_client(): + rmapy = RMClient() + while not rmapy.is_auth(): + print("Enter one-time code (from https://my.remarkable.com/connect/desktop):") + key = input() + rmapy.register_device(key.strip()) + rmapy.renew_token() + return rmapy if __name__ == "__main__": # get/create config + # this also performs the setup if it's run the first time cfg = get_config() - # TODO init remarkabel connection + # Init connection to remarkable server + rmapy = get_rmapy_client() # init all services and apis we need zot = zotero.Zotero(cfg['zot_user_id'], "user", cfg['zot_api_key'])