Giter VIP home page Giter VIP logo

dpt-rp1-py's Introduction

dpt-rp1-py

Python script to manage electronic paper devices made by Sony (Digital Paper, DPT-RP1, DPT-CP1) or Fujitsu (Quaderno) without the Digital Paper App. This repository includes a Python library and a command line utility to manage documents on the reader. Tested on Windows, Linux, and macOS. Should also work for Sony's other digital paper readers.

Throughout this document, reader or device refers to your Digital Paper device.

Installation

We now have a proper Python package, so you may just run:

pip3 install dpt-rp1-py

Installing the package also installs the command line utilities dptrp1 and dptmount. To install the library from the sources, clone this repository, then run python3 setup.py install or pip3 install . from the root directory. To install as a developer use python3 setup.py develop (see the setuptools docs) and work on the source as usual.

Using the command line utility

The command line utility requires a connection to the reader via WiFi, Bluetooth, or USB. The USB connection works on Windows and MacOS but may not work on a Linux machine.

To see if you can successfully connect to the reader, try the command dptrp1 list-documents. If you have Sony's Digital Paper App installed, this should work without any further configuration. If this fails, register your reader with the app using dptrp1 register.

Basic usage

Here you see some basic usage examples for the utility. Text following a dollar sign is the command as entered on the command line on MacOS or Linux. Your paths may look slightly different on Windows.

Registering the device

This command pairs the command line utility to your reader. You only need to run this once. Keep the device nearby, you will need to read a code from the display and enter it.

$ dptrp1 register                                                                                 
Discovering Digital Paper for 30 seconds…
Found Digital Paper with serial number 500XXXX
Cleaning up...
<Response [204]>
Requesting PIN...
Encoding nonce...
Please enter the PIN shown on the DPT-RP1: 

Listing all documents on the device

$ dptrp1 list-documents                                                                                 
Document/Note/Graph_20171022.pdf
Document/Work/Scans/Contract.pdf
Document/Papers/svetachov2010.pdf
Document/Papers/sporns2012.pdf

Getting general usage instructions

$ dptrp1 -h
usage: dptrp1 [-h] [--client-id CLIENT_ID] [--key KEY] [--addr ADDR]
              [--serial SERIAL] [--yes] [--quiet]
              {copy-document,[...],wifi-scan}
              [command_args [command_args ...]]

Remote control for Sony DPT-RP1

positional arguments:
  {copy-document,[...],wifi-scan}
                        Command to run
  command_args          Arguments for the command

optional arguments:
  -h, --help            show this help message and exit
  --client-id CLIENT_ID
                        File containing the device's client id
  --key KEY             File containing the device's private key
  --addr ADDR           Hostname or IP address of the device. Disables auto
                        discovery.
  --serial SERIAL       Device serial number for auto discovery. Auto
                        discovery only works for some minutes after the
                        Digital Paper's Wi-Fi setting is switched on.
  --yes, -y             Automatically answer yes to confirmation prompts, for
                        running non-interactively.
  --quiet, -q           Suppress informative messages.

Getting help for the upload command

$ dptrp1 help upload

    Usage: dptrp1 upload <local_path> [<remote_path>]

    Upload a local document to the reader.
    Will upload to Document/ if only the local path is specified.

Uploading a document to the reader

$ dptrp1 upload ~/Desktop/scan.pdf

Opening the second page of a document on the reader

$ dptrp1 display-document Document/scan.pdf 2

Connecting to a WiFi network

This command requires the path to a WiFi configuration file as a parameter. Look at the sample configuration file and put your network name in the ssid field and your password into the passwd field. You can generally leave the other fields unchanged.

$ dptrp1 wifi-add config.json

Supported commands

You can get a list of the implemented commands by running dptrp1 with no additional arguments. The most important commands for everyday use are register, help, upload, download, and sync.

You can get additional information about a specific command by calling dptrp1 help <command>, e.g. dptrp1 help sync.

Note that the root path for DPT-RP1 is always Document/, which is misleadingly displayed as "System Storage" on the device. To download a document called file.pdf from a folder called Articles of the DPT-RP1, the correct command is dptrp1 download Document/Articles/file.pdf.

Registering the DPT-RP1

The DPT-RP1 uses SSL encryption to communicate with the computer. This requires registering the DPT-RP1 with the computer, which results in two pieces of information, the client ID and the private key. If you have used Sony's Digital Paper App on the same computer, the utility will automatically try to use the existing credentials. If you do not have the Digital Paper App, use the register command.

Registering without the Digital Paper App

If you want to use a WiFi connection, make sure that the reader and your computer are connected to the same WiFi network. Some versions of the DPT-RP1 do not allow you to connect to a WiFi network from the device itself. In this case, use Bluetooth or USB first to configure the WiFi network (using the wifi-add command) or update the firmware (using update-firmware).

The tool can generally figure out the correct IP address of the device automatically, but you may also specify it with the --addr <address> option. If you're on WiFi, go to Wi-Fi Settings on the device and tap the connected network to see the device's address. If you use a Bluetooth connection, it's likely 172.25.47.1. You can also try the hostname digitalpaper.local. Use the register command like seen below, substituting the IP address of the device.

dptrp1 --addr 10.0.0.1 register

If you get an error, wait a few seconds and try again. Sometimes it takes two or three tries to work.

Mounting as a file system

This Repository contains a dptmount script to mount the Digital Paper as a userspace mount. This tool has additional requirements.

  • On macOS, install osxfuse (e.g. with brew cask install osxfuse).
  • On Linux, you may need to install libfuse.

How to use

Create a yaml file with configuration details at ~/.config/dpt-rp1.conf. You must specify either an address (with addr) or a Device ID (with serial). All entries must be strings, the serial number must be wrapped in quotation marks.

dptrp1:
  addr: 192.168.0.200
  serial: "50040222"
  client-id: ~/.config/dpt/deviceid.dat
  key: ~/.config/dpt/privatekey.dat

If you register with dptrp1 register command, the client-id shall be $HOME/.dpapp/deviceid.dat, and key shall be $HOME/.dpapp/privatekey.dat. Mount the Digital Paper to a directory with dptmount --config ~/.config/dpt-rp1.conf /mnt/mountpoint

Finding the private key and client ID on Windows

If you have already registered on Windows, the Digital Paper app stores the files in Users/{username}/AppData/Roaming/Sony Corporation/Digital Paper App/. You'll need the files deviceid.dat and privatekey.dat.

Finding the private key and client ID on macOS

If you have already registered on macOS, the Digital Paper app stores the files in $HOME/Library/Application Support/Sony Corporation/Digital Paper App/. You'll need the files deviceid.dat and privatekey.dat.

What works

  • Reading files
  • Moving files (both rename and move to different folder)
  • Uploading new files
  • Deleting files and folders

What does not work

  • Currently there is no caching, therefore operations can be slow as they require uploading or downloading from the device. However, this avoids having to resolve conflicts if a document has been changed both on the Digital Paper and the caching directory.

dpt-rp1-py's People

Contributors

alex-fu27 avatar alicelyy avatar arcolife avatar bpteague avatar cristobaltapia avatar cuihtlauac avatar cvcore avatar cycomanic avatar easilylazy avatar farhaven avatar hakon-j-d-johnsen avatar hallyn avatar happyz avatar hisaknown avatar janten avatar jgrigera avatar mezzarobba avatar nicolashug avatar pi8027 avatar plaublin avatar tao-j avatar vico avatar victrid avatar x-ji avatar y-yu avatar yadayada avatar yunjae2 avatar ztuowen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dpt-rp1-py's Issues

Question regarding the remote path in upload

Hi:

I tried to upload several books to my dpt-rp1. But I had problem with remote path.

In my dpt-rp1, I have folder Document to store my pdf files.
I tried this:

dptrp1 --client-id deviceid.dat --key privatekey.dat --addr 192.168.1.28 upload Convex_optimization.pdf /Document

But I got an error saying something is wrong with entry_id.

Could you help me fix this problem?

Best

Issue on delete folder

Hi:
Thanks for your wonderful project, it helps me a lot. However, there is something wrong when I try to delete a remote subfolder: it just keeps silent just like nothing was wrong, but nothing happens with my device.
There is nothing wrong with list documents or upload files, I can even create new folder on my device, so I did use it in a right way.
I do these on linux OS, connect my device with wifi, register it successfully. Can anybody give me some suggestions?
Thanks a lot!

USB Ethernet Fails

Trying to register on linux(Ubuntu 18.04 LTS, KDE). I followed the guide to feed a byte sequence by this command:
I got IPv6 address just fine:
Ethernet:
be:a7:89:f5:55:c3
IPv6(link-local):
fe80::244f:46ff:fe5c:cbe9
IPv6(w/ scope identifier):
fe80::244f:46ff:fe5c:cbe9%enp0s20f0u11
(I noticed ifconfig has a different address?)
Final URI:
https://[fe80::244f:46ff:fe5c:cbe9%enp0s20f0u11]:8443/...
(what is this 8843?)
But what's the syntax to actually register? ALL I've tried gives me timeed out error from urllib.

upload command failed without any error feedback

The upload command must failed without any error feedback if some non-ASCII characters in target file name. (the silent failed upload command still hang on a little while, but no file will be in the target path. If I change these non-ASCII characters with some alphabet characters, everything will be fine.)

The situation happened on my both Mac & Linux environment.

Thanks @janten for the works, If you could give me some clue about the bug,I would dig into to fix it.

privatekey.dat and deviceid.dat location on macOS

After register with Digital Paper app on Mac. privatekey.dat and deviceid.dat can found in ~/Library/Application Support/Sony Corporation/Digital Paper App/.

You could simplify Extracting step in Mac.

Bulk upload/dowload?

Is there a way to bulk upload a bunch of PDF files via the upload command. or download them from the device from a specific folder thereof?

For upload I currently usethis BASH script I quickly put together>

#!/bin/bash
cd /home/cypress/Desktop/13eink/
for f in *.pdf
do
dptrp1 --client-id /home/cypress/.dtp-client --key /home/cypress/.dtp.key --addr 192.168.1.170 upload /home/cypress/Desktop/13eink/$f Document/Pocket/$f
echo "Uploaded $f to Sony DPT-RP1"
done

Converted a bunck of Pocket articles into PDF using a Firefox plugin and put them all into /home/cypress/Desktop/13eink/. Ran the script and all went well, it uploaded every PDF file in /home/cypress/Desktop/13eink/ to Document/Pocket/ on the device preserving filename. Please not that special characters in the filename (such as ”:”) interfere with the script's syntax.

Issue getting Ethernet-over-USB working

Hi,

First things first, thanks so much for this python script! I've got a headscratcher. I followed the documents in "docs" https://github.com/janten/dpt-rp1-py/blob/master/docs/linux-ethernet-over-usb.md for getting ethernet-over-usb working. I managed to send the serial command for cdc/ecm mode, and set up Network Manager to assign it a local ip. Hence, avahi-resolve -n digitalpaper.local gives me a legit ipv6:

fe80::90df:46ff:fe5c:c471

According to ifconfig my DPTRP1 is:

enp0s20f0u1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 169.254.217.149 netmask 255.255.0.0 broadcast 169.254.255.255
inet6 fe80::7c07:fd10:f9b5:c4f0 prefixlen 64 scopeid 0x20
ether 72:c4:5c:46:df:93 txqueuelen 1000 (Ethernet)
RX packets 3 bytes 878 (878.0 B)
RX errors 0 dropped 0 overruns 0 frame 0

However, I'm stumped on the next step. I've tried various combinations in --addr argument for dptrpt1 but I get errors, e.g.: err.txt output when I try

peterjh@auriol ~ $ dptrp1 --addr "[fe80::90df:46ff:fe5c:c471%enp0s20f0u1]" list-folders 2> err.txt

I tried various other combinations, but much the same. Thanks in advance!
err.txt

Readme File for usage

Hi Jan,

Thanks for the great work. Could you please upload a readme file for usage? It doesn't work at my end.

Best,
Sway

Question about sync and original app

It is very nice that the full source to the sony app is available.
However, on the mac the app is quite horrible.

So I wanted to ask:

  1. How difficult would it be to implement syncing?
    Is there a way to see changed files? Modification times on files?

  2. Could we maybe collect information on the sony app? What have you already figured out?
    For example, I understand it works with a database on the computer side.
    Where is that database? Or is the whole database on the rp1?
    Did you find ways to insert small debugging dialogs/printouts into the program?
    I guess it is possible to debug with console.log()

Currently something is wrong with my sync - it finishes quite quickly, but then gets stuck forever and eventually returns with an error 17-0000-0000.

Oh, I found the database. On the mac.
It is
~/Library/Application Support/Sony Corporation/Digital Paper App/sqlite3.db

This database has 2 tables: file_stamp, sync_folder_pair

sync_folder_pair simply has a list of the synced folders.

file_stamp is more interesting. Its columns are
syncId, localFolderPath, localFileName, localStamp, remoteFolderPath, remoteFileName, remoteStamp.

All pretty self-explanatory. Except for localStamp and remoteStamp. They are not identical.
localStamp looks like: bdba629e0f11b377f48759184ebf0aac, and remoteStamp looks like b5ea42e3b838.1.0 (this is for the same file). I'll try to dig deeper to see how they are used, and how the database is updated.

'dpt-rp1-py==0.1.6' distribution not found

I get the following error when I run dptrp1 --help (or any other command):

Traceback (most recent call last):
  File "/usr/bin/dptmount", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3251, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3234, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3263, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'dpt-rp1-py==0.1.6' distribution was not found and is required by the application

Seems to be related to a recent python upgrade.

KeyError: 'TRAVIS_TAG'

Hi,

First time user -- noticed you had changes from yesterday, so maybe this is already a known problem. Happy to supply more information (Archlinux, running python3):

I get this error when I run pip install dpt-rp1-py:

peterjh@auriol ~/src/dpt-rp1-py-0.1.1 $ pip install dpt-rp1-py
Collecting dpt-rp1-py
Using cached https://files.pythonhosted.org/packages/0f/c8/56745214b09d9812a528126a1d6560b222883e1e8b60419effdf93a100b8/dpt-rp1-py-0.1.1.tar.gz
Complete output from command python setup.py egg_info:
! Error loading setup.json file in the same directory as setup.py.
Check your installation.
Exception: [Errno 2] No such file or directory: '/tmp/pip-install-d1wd3zy5/dpt-rp1-py/setup.json'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-d1wd3zy5/dpt-rp1-py/

I get this error when I try to compile it:

peterjh@auriol ~/src/dpt-rp1-py-0.1.1 $ pip3 install .
Processing /home/peterjh/docs/src/dpt-rp1-py-0.1.1
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-req-build-cqpg7swb/setup.py", line 44, in
version=os.environ['TRAVIS_TAG'].replace("v", ""),
File "/usr/lib/python3.7/os.py", line 678, in getitem
raise KeyError(key) from None
KeyError: 'TRAVIS_TAG'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-cqpg7swb/

Subpath issue

Hello, thanks for the script!

I have tested it on Ubuntu with IPv6. All the operations with only one path are working fine (e.g. upload documents to Document/... ; List documents; create new folder under Document/...)

However, all the operations requiring a subpath does not work (Includeing download file, delete file, create subfolder).

For example:
dptrp1 --client-id ~/deviceid.dat --key ~/privatekey.dat --addr [f e80::xxxx:xxxx:xxxx:xxxx%enp0s20u1] new-folder Document/test <- this works.

sudo dptrp1 --client-id ~/deviceid.dat --key ~/privatekey.dat --addr [f e80::xxxx:xxxx:xxxx:xxxx%enp0s20u1] new-folder Document/test/test <-this does not work

I have checked the URL before sending the request, for the operations with subfolders, "/" is encoded to "%2F". But I still can not figuer the issue out.

The error is:

req: <Response [404]>
Error: 40401 The designated resource was not found.
status: 404
Traceback (most recent call last):
File "/usr/local/bin/dptrp1", line 4, in
import('pkg_resources').run_script('dpt-rp1-py==0.1.0', 'dptrp1')
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 719, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1504, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python3.5/dist-packages/dpt_rp1_py-0.1.0-py3.5.egg/EGG-INFO/scripts/dptrp1", line 142, i
n
commands[args.command](dp, *args.command_args)
File "/usr/local/lib/python3.5/dist-packages/dpt_rp1_py-0.1.0-py3.5.egg/EGG-INFO/scripts/dptrp1", line 41, in
do_new_folder
d.new_folder(remote_path)
File "/usr/local/lib/python3.5/dist-packages/dpt_rp1_py-0.1.0-py3.5.egg/dptrp1/dptrp1.py", line 272, in new_f
older
directory_id = self._resolve_object_by_path(remote_directory).json()['entry_id']
KeyError: 'entry_id'

Anyone could help? Thanks.

list-document error: KeyError: 'entry_list'

dptrp1 --client-id ~/deviceid.dat --key ~/privatekey.dat --addr 10.0.0.4 list-documents                                                                 
Traceback (most recent call last):
  File "/home/jx/.local/bin/dptrp1", line 137, in <module>
    commands[args.command](dp, *args.command_args)
  File "/home/jx/.local/bin/dptrp1", line 18, in do_list_documents
    data = d.list_documents()
  File "/home/jx/.local/lib/python3.6/site-packages/dptrp1/dptrp1.py", line 227, in list_documents
    return data['entry_list']
KeyError: 'entry_list'

Seems that d.list_documents() didn't successfully return a dictionary that contains key entry_list for some reason.

Location of configuration files

Hi, thanks for keep making improvements to this nice library!

As far as I understand the default location for the configuration files is ~/.dpapp (in Linux at least, introduced in 27626c8). However, in the Readme file, when describing how to use dptmount, the impression is given that the default folder is ~/.config/dpt (which I actually kind of like more, but that is another issue :P ). I think that this should be consistent and: (a) either change the path shown in the Readme file or (b) change the default location for the configuration files.

Can you help to add "testmode" into the command list pls?

The Sony DPT-RP1 provides the "testmode" via API, can you help to add it into your command list pls? with this command, we may enable the testmode for DPT-RP1 and may root it.

"/testmode/auth/nonce":
"/testmode/auth":
"/testmode/launch":
"/testmode/recovery_mode":

Thank you!
Steven

Path.home() undefined

Hi thanks for the great program! --- been running it a month now. One of the newer commits broke something on my linux machine:

On line 28 (in get_default_auth_files()) the line:

config_path = os.path.join(Path.home(), ".dpapp")

fails on my Linux (archlinux, python3) system. This appears to be part of one of the recent git commits. Change the line to:

config_path = os.path.join("/home/peterjh/.dpapp")

makes it work --- although clearly there's likely a much better solution. Will dig a bit deeper happy to test a patch locally

Unable to register the device

System: Ubuntu 16.04 LTS
Python: 3.5.2

When I try to register the device with dptrp1 --client-id deviceid.dat --key privatekey.dat --addr 10.0.0.8 register, I get the following error:

Cleaning up...
<Response [204]>
Requesting PIN...
<Response [200]>
Encoding nonce...
<Response [403]>
Traceback (most recent call last):
  File "/usr/local/bin/dptrp1", line 118, in <module>
    _, key, device_id = dp.register()
  File "/usr/local/lib/python3.5/dist-packages/dptrp1/dptrp1.py", line 107, in register
    if(base64.b64decode(m3['a']) != n2):
KeyError: 'a'

Any idea what happened here?

I'm sure my computer and the device are both connected to the same WiFi network.

Explain the path issues

It took me a long time to figure out that all paths have to be preceded with Document/.

It would be good to add this to the documentation, maybe even modify the program so that it adds Document/ on its own,

dptmount: file tree representation breaks on first read operation

I tried dptmount for the first time today. I love the idea to be able to mount the device just like any other drive. So i created a config.yaml and a directory test. I called

python -m dptrp1.cli.dptmount --config config.yaml --verbose test/

in the repository's directory on my pc. Using a second shell, in the same directory I issued:

cp "test/Studium/Theo II/blatt01.pdf" ~/uni/theo2/

Which works well on the first time:

...
DEBUG:fuse.log-mixin:-> read /Studium/Theo II/blatt01.pdf (40960, 0, 1)
DEBUG:fuse.log-mixin:<- read b'%PDF-1.7\n%\xc7\xec\x8f\xa2\n5 0 obj\n<</Length
...

But when I run the same cp command a second time, I get "cp: cannot stat (...) invalid argument". The log of dptmount lists the following exception:

DEBUG:fuse.log-mixin:-> getattr /Studium/Theo II/blatt01.pdf (None,)
DEBUG:fuse.log-mixin:<- getattr '[Unhandled Exception]'
ERROR:fuse:Uncaught exception from FUSE operation getattr, returning errno.EINVAL.
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/fuse.py", line 734, in _wrapper
    return func(*args, **kwargs) or 0
  File "/usr/lib/python3.7/site-packages/fuse.py", line 774, in getattr
    return self.fgetattr(path, buf, None)
  File "/usr/lib/python3.7/site-packages/fuse.py", line 1027, in fgetattr
    attrs = self.operations('getattr', self._decode_optional_path(path), fh)
  File "/usr/lib/python3.7/site-packages/fuse.py", line 1251, in __call__
    ret = getattr(self, op)(path, *args)
  File "/mnt/c/Users/Alexander/projects/dpt/dpt-rp1-py/dptrp1/cli/dptmount.py", line 180, in getattr
    node = self._map_local_remote(path)
  File "/mnt/c/Users/Alexander/projects/dpt/dpt-rp1-py/dptrp1/cli/dptmount.py", line 160, in _map_local_remote
    return anytree.search.find(self.root, filter_=lambda node: node.localpath == full_local)
  File "/usr/lib/python3.7/site-packages/anytree/search.py", line 161, in find
    return _find(node, filter_=filter_, stop=stop, maxlevel=maxlevel)
  File "/usr/lib/python3.7/site-packages/anytree/search.py", line 213, in _find
    items = _findall(node, filter_, stop=stop, maxlevel=maxlevel, maxcount=1)
  File "/usr/lib/python3.7/site-packages/anytree/search.py", line 225, in _findall
    raise CountError(msg % (maxcount, resultlen), result)
anytree.search.CountError: Expecting 1 elements at maximum, but found 2. (Node('/Document/Studium/Theo II/blatt01.pdf', item={'created_date': '2019-10-17T08:49:13Z', 'current_page': '1', 'document_source': '8192339f-4f4f-40ba-9f14-11f239bf6549', 'document_type': 'normal', 'entry_id': 'e4b0f675-8b94-4f3e-9f1e-6fadd005e90c', 'entry_name': 'blatt01.pdf', 'entry_path': 'Document/Studium/Theo II/blatt01.pdf', 'entry_type': 'document', 'file_revision': '6fadd005e90c.1.0', 'file_size': '38539', 'is_new': 'true', 'mime_type': 'application/pdf', 'modified_date': '2019-10-17T08:49:13Z', 'parent_folder_id': 'fdb61eb6-6686-4408-91dd-c7c737317d1f', 'title': 'blatt1.dvi', 'total_page': '2'}, localpath='/Studium/Theo II/blatt01.pdf', lstat={'st_atime': 1571302172.7793748, 'st_gid': 985, 'st_uid': 1000, 'st_ctime': 1571302153, 'st_mode': 33188, 'st_mtime': 1571302153, 'st_nlink': 1, 'st_size': 38539}, remote_path='Document/Studium/Theo II/blatt01.pdf'), Node('/Document/Studium/Theo II/blatt01.pdf', item={'created_date': '2019-10-17T08:49:44Z', 'current_page': '1', 'document_source': '8192339f-4f4f-40ba-9f14-11f239bf6549', 'document_type': 'normal', 'entry_id': '5dfcaf61-3e3c-41d0-bc7d-9d772831bf70', 'entry_name': 'blatt01.pdf', 'entry_path': 'Document/Studium/Theo II/blatt01.pdf', 'entry_type': 'document', 'ext_id': '', 'file_revision': '9d772831bf70.1.0', 'file_size': '38539', 'is_new': 'true', 'mime_type': 'application/pdf', 'modified_date': '2019-10-17T08:49:44Z', 'parent_folder_id': 'fdb61eb6-6686-4408-91dd-c7c737317d1f', 'title': 'blatt1.dvi', 'total_page': '2'}, localpath='/Studium/Theo II/blatt01.pdf', lstat={'st_atime': 1571302172.7793748, 'st_gid': 985, 'st_uid': 1000, 'st_ctime': 1571302184, 'st_mode': 33188, 'st_mtime': 1571302184, 'st_nlink': 1, 'st_size': 38539}, remote_path='Document/Studium/Theo II/blatt01.pdf'))

It looks like all entries are listed twice now.

Issues with firmware 1.6.00.15110

I'm experiencing issues since I've updated to 1.6.00.15110. Frequently, communication fails. I have to either turn Wi-Fi off and on or reboot in order to be able to establish successful communication. Once working, it seems that uploading a file leaves something in a dirty state since communication is broken once again.

Error when using DPT-RP1-py in Android Terminal

I am trying to use this Python script on my phone by running it in a Linux environment (Termux on Android 8, Python 3.6 interpreter) so that I can upload PDFs to my device from my phone. I successfully installed the script and moved the private key and device ID to the phone from my computer. I was able to register my phone with my DPT-RP1 and list out all of the files on it, but when I try to upload or download PDFs, I always get an error on this line:

directory_id = directory_entry["entry_id"]

I was wondering if you knew what would cause this problem or where I could look for possible causes.

Thanks!

deviceid.dat

xxxxx@DESKTOP-QV2HMLF MINGW64 /c/dpt-rp1-py-master
$ dptrp1 --client-id deviceid.dat --key privatekey.dat --addr 172.30.1.8 list-documents
Traceback (most recent call last):
File "C:/Users/gkhs1/AppData/Local/Programs/Python/Python37/Scripts/dptrp1", line 161, in
with open(args.client_id) as fh:
FileNotFoundError: [Errno 2] No such file or directory: 'deviceid.dat'

What should i do????

Timeout error on list-documents

I'm on OSX 10.11.6
I managed to install, and extract client_id and key.

When I try to list documents, I get the following error after a long while:

> dptrp1 --addr 10.10.5.26 --client-id client_id.txt --key key.pem list-documents
Traceback (most recent call last):
  File "/usr/local/bin/dptrp1", line 137, in <module>
    commands[args.command](dp, *args.command_args)
  File "/usr/local/bin/dptrp1", line 18, in do_list_documents
    data = d.list_documents()
  File "/usr/local/lib/python3.6/site-packages/dptrp1/dptrp1.py", line 227, in list_documents
    return data['entry_list']
KeyError: 'entry_list'

Is there an option to get more debugging info? Something like -v ?

Thanks!

About keeping the file on dpt-rp1 open when uploading a new version to dpt-rp1.

Hi there,

Thank you so much for this python module. The module is excellent. I'm thinking whether we can add a new functionality, such that when I upload a pdf file to the dpt-rp1, the pdf file that I'm reading on dpt-rp1 (with the same file name) will not be closed, and will be refreshed.
(Indeed if you are reading a pdf named "main.pdf" on dpt-rp1, and if you upload a new version of "main.pdf" to dpt-rp1, the "main.pdf" on dpt-rp1 will be first deleted, and you have to open manually the newly uploaded one, which is not convenient to me, since I'm always modifying a pdf that I'm reading on dpt-rp1.) I don't know whether this is feasible.

About client_id

Hi can I find the client_id?

This id seems to be generated unique to every device.

Thanks

Sync is unidirectional

Running the sync command only syncs files from the DPT-RP1 to the computer (and not the converse).
For example, I have a subfolder on my computer whose contents are not uploaded to the same, empty folder on the DPT-RP1.

Using v1.6 (although I do not think this is relevant).

Command input problem

I am a newcomer in programming.I want to ask where the command is entered. When I type in cmd and python, there is no dptrp1 command group.
for example:'dptrp1' is not an internal or external command, nor a runnable program or batch file.

Can U answer me ? thank U very much

Pair back with dpt app failed

Hi,

It seems that it failed when I pair the dpt-rp1 with the original App.
Does anyone know how to solve it?
Thank you!

Best,
Rui

A lot of docs are synced again after paired with another computer

Thanks for this fantastic tool! I have a question about syncing using two computers.

After I pair my DPT-RP1 with a new computer, I need to sync a Dropbox folder to my digital paper, both this tool (and the official digital paper app) will upload a lot of documents again. I use Dropbox to sync that folder between different computers, and on both computers the paths are exactly the same.

I was wondering what is the possible reason that exactly the same document would be treated differently? Thanks!

Please add a note explaining where Pip installs binaries to your Readme

Hi,

I ran the install commands as given and the commands do not work:

larry@amiko:~$ pip3 install dpt-rp1-py
Collecting dpt-rp1-py
  Downloading https://files.pythonhosted.org/packages/45/a2/9237a6e3ac7a3cd896d2a1a4c040f886f50ae30e739aa8df97f7ab57da8a/dpt-rp1-py-0.1.6.tar.gz
Collecting anytree (from dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/a8/65/be23d8c3ecd68d40541d49812cd94ed0f3ee37eb88669ca15df0e43daed1/anytree-2.8.0-py2.py3-none-any.whl (41kB)
    100% |████████████████████████████████| 51kB 2.4MB/s 
Collecting fusepy (from dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/04/0b/4506cb2e831cea4b0214d3625430e921faaa05a7fb520458c75a2dbd2152/fusepy-3.0.1.tar.gz
Collecting httpsig>=1.1.2 (from dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/16/93/4ac4548fccfc3d530ac9dcd2c5cfec087b41004a16b85c33e670b786a565/httpsig-1.3.0-py2.py3-none-any.whl
Collecting pbkdf2>=1.3 (from dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/02/c0/6a2376ae81beb82eda645a091684c0b0becb86b972def7849ea9066e3d5e/pbkdf2-1.3.tar.gz
Collecting pyyaml (from dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/3d/d9/ea9816aea31beeadccd03f1f8b625ecf8f645bd66744484d162d84803ce5/PyYAML-5.3.tar.gz (268kB)
    100% |████████████████████████████████| 276kB 3.9MB/s 
Collecting requests>=2.18.4 (from dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl (57kB)
    100% |████████████████████████████████| 61kB 3.3MB/s 
Collecting urllib3>=1.22 (from dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/b4/40/a9837291310ee1ccc242ceb6ebfd9eb21539649f193a7c8c86ba15b98539/urllib3-1.25.7-py2.py3-none-any.whl (125kB)
    100% |████████████████████████████████| 133kB 4.6MB/s 
Collecting zeroconf (from dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/f7/ab/3e4d23b14c7afef0c88d7839dd1157241a4e629f4d72ced35b0eba9ad806/zeroconf-0.24.4-py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 3.5MB/s 
Collecting six>=1.9.0 (from anytree->dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Collecting pycryptodome<4,>=3 (from httpsig>=1.1.2->dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/93/79/30fb604bf82abbab621ecdbbca932d294e1d4cf95336bb3fc2b5871d297a/pycryptodome-3.9.4-cp36-cp36m-manylinux1_x86_64.whl (9.7MB)
    100% |████████████████████████████████| 9.7MB 198kB/s 
Collecting certifi>=2017.4.17 (from requests>=2.18.4->dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl (156kB)
    100% |████████████████████████████████| 163kB 6.2MB/s 
Collecting idna<2.9,>=2.5 (from requests>=2.18.4->dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
    100% |████████████████████████████████| 61kB 3.4MB/s 
Collecting chardet<3.1.0,>=3.0.2 (from requests>=2.18.4->dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 2.8MB/s 
Collecting ifaddr (from zeroconf->dpt-rp1-py)
  Downloading https://files.pythonhosted.org/packages/9f/54/d92bda685093ebc70e2057abfa83ef1b3fb0ae2b6357262a3e19dfe96bb8/ifaddr-0.1.6.tar.gz
Building wheels for collected packages: dpt-rp1-py, fusepy, pbkdf2, pyyaml, ifaddr
  Running setup.py bdist_wheel for dpt-rp1-py ... done
  Stored in directory: /home/larry/.cache/pip/wheels/5e/f7/58/4c01b7cf945ed620eb00879b1e2d3568c418bcfdf31772b501
  Running setup.py bdist_wheel for fusepy ... done
  Stored in directory: /home/larry/.cache/pip/wheels/4c/a5/91/7772af9e21c461f07bb40f26d928d7d231d224977dd8353bab
  Running setup.py bdist_wheel for pbkdf2 ... done
  Stored in directory: /home/larry/.cache/pip/wheels/8e/62/b9/0bf3a68f2111e169253ec4d2bbdc303c46777b7fc99bbbf230
  Running setup.py bdist_wheel for pyyaml ... done
  Stored in directory: /home/larry/.cache/pip/wheels/e4/76/4d/a95b8dd7b452b69e8ed4f68b69e1b55e12c9c9624dd962b191
  Running setup.py bdist_wheel for ifaddr ... done
  Stored in directory: /home/larry/.cache/pip/wheels/1a/78/2c/a5bbe977f6d91039ddc1d657e780cb55a493aa5d2c0b64637a
Successfully built dpt-rp1-py fusepy pbkdf2 pyyaml ifaddr
Installing collected packages: six, anytree, fusepy, pycryptodome, httpsig, pbkdf2, pyyaml, certifi, urllib3, idna, chardet, requests, ifaddr, zeroconf, dpt-rp1-py
Successfully installed anytree-2.8.0 certifi-2019.11.28 chardet-3.0.4 dpt-rp1-py-0.1.6 fusepy-3.0.1 httpsig-1.3.0 idna-2.8 ifaddr-0.1.6 pbkdf2-1.3 pycryptodome-3.9.4 pyyaml-5.3 requests-2.22.0 six-1.14.0 urllib3-1.25.7 zeroconf-0.24.4
larry@amiko:~$ dptrp1
dptrp1: command not found

Access over USB failing if https_proxy environment variable set

Step to reproduce.

  1. Get a machine behind a proxy (this might be the easiest or hardest point)
  2. Disable Wi-Fi on the DPT-RP1
  3. Connect the DPT-RP1 using a USB cable
  4. Set the connection to CDC-ECM. I'm doing: printf "\x01\x00\x00\x01\x00\x00\x00\x01\x01\x04" > /dev/ttyACM0
  5. Find the DPT-RP1 IPv6 address. I'm doing: avahi-resolve -n digitalpaper.local
  6. Find the DPT-RP1 network interface name. I'm using ifconfig
  7. Try to get the list of the documents. It fails
    python3 bin/dptrp1 --addr "[fe80::xxxx:xxxx:xxxx:xxxx%enp0s20u4u1]" --client-id ... --key ... list-documents
  8. Unset the https_proxy variable
  9. Retry. It works.

Most probably related with urllib3/requests.

delete do not work over USB connection

ubuntu:~/E-Book$ dptrp1 --client-id .dpt-client --key .dpt.key --addr [fe80::60a7:46ff:fe5d:3375%enp0s20u9] list-documents
Document/Samples/Note_Sample.pdf
Document/Note/Legal Pad_20180721 (2).pdf
Document/Note/Legal Pad_20180721 (1).pdf
Document/Note/Legal Pad_20180721.pdf
Document/Samples/Basic_Operation_Guide.pdf
Document/dia.pdf
Document/Samples/Document_Sample.pdf
Document/Samples/Connectivity_Guide.pdf
rus@Yasha:~/E-Book$ dptrp1 --client-id .dpt-client --key .dpt.key --addr [fe80::60a7:46ff:fe5d:3375%enp0s20u9] delete Document/dia.pdf
Traceback (most recent call last):
  File "/usr/local/bin/dptrp1", line 142, in <module>
    commands[args.command](dp, *args.command_args)
  File "/usr/local/bin/dptrp1", line 38, in do_delete_document
    data = d.delete_document(remote_path)
  File "/usr/local/lib/python3.6/dist-packages/dptrp1/dptrp1.py", line 239, in delete_document
    remote_id = self._resolve_object_by_path(remote_path).json()['entry_id']
KeyError: 'entry_id'
ubuntu:~/E-Book$ 

httpsig made Signer.sign public

When I run this program, it meets this problem

File "dptrp1.py", line 214, in authenticate
    signed_nonce = sig_maker._sign(nonce)
AttributeError: 'Signer' object has no attribute '_sign'

httpsig module made Signer.sign method public, so the method _sign should be replaced by sign

ahknight/httpsig@60dbb7b

signed_nonce = sig_maker.sign(nonce)

can you add license?

Hi,

can you add license file? I would like to fork and add FUSE interface, but I am employee of large corp and I need a clearance to proceed. Without license on your code I am not sure about their answer.

Kindest Regards

How did you find out these APIs?

Hi janten thank you very much for working on this wonderful project.
I wonder how did you find out the APIs such as /system/configs/wifi_accesspoints or /documents2, etc.
Is there a tool to sniff it?

operation return 404

Env: debian stretch
python: python3
DPT-RP1
the deviceid.dat and the private.dat are extract from windows
Does anyone get this error message?

./dptrp1-tools --client-id ./ws14c5c4498078433c9129970577080565/deviceid.dat --key ./ws14c5c4498078433c9129970577080565/privatekey.dat --addr digitalpaper.local delete Documents/doctor-papers/TR1846.pdf
remote path isDocuments/doctor-papers/TR1846.pdf


Documents/doctor-papers/TR1846.pdf
/resolve/entry/path/Documents/doctor-papers/TR1846.pdf
get point https://digitalpaper.local:8443/resolve/entry/path/Documents/doctor-papers/TR1846.pdf
<Response [404]>
{'Credentials': 'pZrIbn4m9KgvkKtMfJgV4Zt02M7KSAfkHegBc0QcVSJl1/0peu/qSfHs+nu0g1vt'}
<Response [404]>
get point https://digitalpaper.local:8443/resolve/entry/path/Documents/doctor-papers/TR1846.pdf
<Response [404]>
{'Credentials': 'pZrIbn4m9KgvkKtMfJgV4Zt02M7KSAfkHegBc0QcVSJl1/0peu/qSfHs+nu0g1vt'}
Traceback (most recent call last):
File "./dptrp1-tools", line 155, in
commands[args.command](dp, *args.command_args)
File "./dptrp1-tools", line 50, in do_delete_document
data = d.delete_document(remote_path)
File "/home/charlies/.local/lib/python3.5/site-packages/dptrp1/dptrp1.py", line 259, in delete_document
remote_id = self._resolve_object_by_path(remote_path).json()['entry_id']
KeyError: 'entry_id'

maintain file times

Thanks for the great program!

It would be great if file modification times survive the transfer in both directions and such times are listed when using the list-document command.

Document date

Is it possible to extract the document date without downloading it?

urllib3 not found on debian but i did install python-urllib3!

running command : python3 setup.py install
get following infomations:
Installing dptrp1 script to /usr/local/bin Installed /usr/local/lib/python3.4/dist-packages/dpt_rp1_py-0.1.0-py3.4.egg Processing dependencies for dpt-rp1-py==0.1.0 Searching for urllib3>=1.22 Reading https://pypi.python.org/simple/urllib3/ Download error on https://pypi.python.org/simple/urllib3/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600) -- Some packages may not be found! Couldn't find index page for 'urllib3' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading https://pypi.python.org/simple/ Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600) -- Some packages may not be found! No local packages or download links found for urllib3>=1.22 error: Could not find suitable distribution for Requirement.parse('urllib3>=1.22')
i check my system did installed all urllib3 but the package name on debian is python3-urllib3 and python-urllib3 .

so after installed dptrp1. running command dptrp1 i get:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 449, in _build_master
ws.require(requires)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 745, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 644, in resolve
raise VersionConflict(dist, req)
pkg_resources.VersionConflict: (urllib3 1.9.1 (/usr/lib/python3/dist-packages), Requirement.parse('urllib3>=1.22'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/dptrp1", line 4, in
import('pkg_resources').run_script('dpt-rp1-py==0.1.0', 'dptrp1')
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2876, in
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 451, in _build_master
return cls._build_from_requirements(requires)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 464, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 639, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: urllib3>=1.22

any ideas about this error?

upload_document error

#!/usr/local/bin/python3
import requests
import httpsig
import urllib3
from urllib.parse import quote_plus
import os

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

class DigitalPaper(object):
    """docstring for DigitalPaper"""
    def __init__(self, client_id):
        super(DigitalPaper, self).__init__()
        self.client_id = client_id
        self.cookies = {}
        
    @property
    def base_url(self):
        return f"https://digitalpaper.local:8443"    
    
    def get_nonce(self):
        url = f"{self.base_url}/auth/nonce/{self.client_id}"
        r = requests.get(url, verify=False)
        return r.json()["nonce"]

    def authenticate(self, path_to_private_key='key.pem'):
        secret = open(path_to_private_key, 'rb').read()
        sig_maker = httpsig.Signer(secret=secret, algorithm='rsa-sha256')
        nonce = self.get_nonce()
        signed_nonce = sig_maker._sign(nonce)
        url = f"{self.base_url}/auth"
        data = {
            "client_id": self.client_id,
            "nonce_signed": signed_nonce
        }
        r = requests.put(url, json=data, verify=False)
        _, credentials = r.headers["Set-Cookie"].split("; ")[0].split("=")
        self.cookies["Credentials"] = credentials

    def get_endpoint(self, endpoint=""):
        url = f"{self.base_url}{endpoint}"
        return requests.get(url, verify=False, cookies=self.cookies)

    def put_endpoint(self, endpoint="", data={}, files=None):
        url = f"{self.base_url}{endpoint}"
        return requests.put(url, verify=False, cookies=self.cookies, json=data, files=files)

    def post_endpoint(self, endpoint="", data={}):
        url = f"{self.base_url}{endpoint}"
        return requests.post(url, verify=False, cookies=self.cookies, json=data)
    
    def upload_document(self, local_path, remote_path):
        filename = os.path.basename(remote_path)
        remote_directory = os.path.dirname(remote_path)
        encoded_directory = quote_plus(remote_directory)
        directory_entry = dp.get_endpoint(f"/resolve/entry/{encoded_directory}").json()
        directory_id = directory_entry["entry_id"]
        info = {
            "file_name": filename,
            "parent_folder_id": directory_id,
            "document_source": ""
        }
        r = dp.post_endpoint("/documents", data=info)
        doc = r.json()
        doc_id = doc["document_id"]
        with open(local_path, 'rb') as local_file:
            files = {
                'file': ("altair.pdf", local_file, 'rb')
            }
            self.put_endpoint(f"/documents/{doc_id}/file", files=files)
        
    def take_screenshot(self):
        url = f"{self.base_url}/system/controls/screen_shot"
        r = requests.get(url, verify=False, cookies=self.cookies)
        with open("screenshot.png", 'wb') as f:
            f.write(r.content)
        
if __name__ == "__main__":
    dp = DigitalPaper(client_id="24c863bd-9629-42de-91e8-cbdfde0d7799")
    dp.authenticate()
    dp.upload_document(local_path='client_id.txt', remote_path='one/')
   # dp.screen_shot()
    endpoints = [
        '/documents',
        '/documents/{}',
        '/documents/{}/file',
        '/documents/{}/copy',

        '/folders',
        '/folders/{}',
        '/folders/{}/entries',

        '/viewer/configs/note_templates',
        '/viewer/configs/note_templates/{}',
        '/viewer/configs/note_templates/{}/file',

        '/viewer/status/preset_marks',
        '/viewer/controls/open',

        '/system/configs',
        '/system/configs/timezone',
        '/system/configs/datetime',
        '/system/configs/date_format',
        '/system/configs/time_format',
        '/system/configs/initialized_flag',
        '/system/configs/timeout_to_standby',
        '/system/configs/owner',

        '/system/status/storage',
        '/system/status/firmware_version',
        '/system/status/mac_address',

        '/system/controls/screen_shot',
        '/system/controls/update_firmware/precheck',
        '/system/controls/update_firmware',
        '/system/controls/update_firmware/file',

        '/system/configs/wifi',
        '/system/configs/wifi_accesspoints',
        '/system/configs/wifi_accesspoints/{}/{}',
        '/system/configs/certificates',
        '/system/configs/certificates/ca',
        '/system/configs/certificates/client',

        '/system/status/wifi_state',
        '/system/status/wps_state',

        '/system/controls/wifi_accesspoints/scan',
        '/system/controls/wifi_accesspoints/register',
        '/system/controls/wps_start/button',
        '/system/controls/wps_start/pin',
        '/system/controls/wps_cancel',

        '/register/serial_number',
        '/register/information',
        '/register/pin',
        '/register/hash',
        '/register/ca',
        '/register',
        '/register/cleanup',

        '/auth/nonce/{}',
        '/auth',

        '/extensions/status',
        '/extensions/status/{}',
        '/extensions/configs',
        '/extensions/configs/{}',

        '/testmode/auth/nonce',
        '/testmode/auth',
        '/testmode/launch',
        '/testmode/recovery_mode',
        '/testmode/assets/{}',

        '/resolve/entry/{}',
        '/api_version',
        '/ping'
    ]
    

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-9-f9bab9623b03> in <module>()
     79     dp = DigitalPaper(client_id="24c863bd-9629-42de-91e8-cbdfde0d7799")
     80     dp.authenticate()
---> 81     dp.upload_document(local_path='client_id.txt', remote_path='one/')
     82    # dp.screen_shot()
     83     endpoints = [

<ipython-input-9-f9bab9623b03> in upload_document(self, local_path, remote_path)
     55         encoded_directory = quote_plus(remote_directory)
     56         directory_entry = dp.get_endpoint(f"/resolve/entry/{encoded_directory}").json()
---> 57         directory_id = directory_entry["entry_id"]
     58         info = {
     59             "file_name": filename,

KeyError: 'entry_id'

Possibility to delete all documents

It's really cumbersome to delete documents on the e-reader itself. The possibility to delete all documents on the e-reader, would make this script perfect. So you can easily upload the topics from your computer, you are currently working on to the e-reader, without worrying, that you use up all space.
Thank you for this software!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.