rmapy package

Submodules

rmapy.api module

rmapy.collections module

class rmapy.collections.Collection(*items)

Bases: object

A collection of meta items

This is basically the content of the Remarkable Cloud.

items

A list containing the items.

add(doc_dict)

Add an item to the collection. It wraps it in the correct class based on the Type parameter of the dict.

Parameters

doc_dict (dict) – A dict representing a document or folder.

Return type

None

add_document(doc_dict)

Add a document to the collection

Parameters

doc_dict (dict) – A dict representing a document.

Return type

None

add_folder(dir_dict)

Add a document to the collection

Parameters

dir_dict (dict) – A dict representing a folder.

Return type

None

children(folder=None)

Get all the children from a folder

Parameters

folder (Optional[Folder]) – A folder where to get the children from. If None, this will get the children in the root.

Return type

List[Union[Document, Folder]]

Returns

a list of documents an folders.

items = []
parent(doc_or_folder)

Returns the paren of a Document or Folder

Parameters

doc_or_folder (Union[Document, Folder]) – A document or folder to get the parent from

Return type

Folder

Returns

The parent folder.

rmapy.config module

rmapy.config.dump(config)

Dump config to the .rmapy config file

Parameters

config (dict) – A dict containing data to dump to the .rmapi config file.

Return type

None

rmapy.config.load()

Load the .rmapy config file

Return type

dict

rmapy.const module

rmapy.document module

class rmapy.document.Document(**kwargs)

Bases: rmapy.meta.Meta

Document represents a real object expected in most calls by the remarkable API

This contains the metadata from a document.

ID

Id of the meta object.

Version

The version of this object.

Success

If the last API Call was a success.

BlobURLGet

The url to get the data blob from. Can be empty.

BlobURLGetExpires

The expiration date of the Get url.

BlobURLPut

The url to upload the data blob to. Can be empty.

BlobURLPutExpires

The expiration date of the Put url.

ModifiedClient

When the last change was by the client.

Type

Currently there are only 2 known types: DocumentType & CollectionType.

VissibleName

The human name of the object.

CurrentPage

The current selected page of the object.

Bookmarked

If the object is bookmarked.

Parent

If empty, this object is is the root folder. This can be an ID of a CollectionType.

__repr__()

String representation of this object

__str__()

String representation of this object

class rmapy.document.RmPage(page, metadata=None, order=0, thumbnail=None, _id=None)

Bases: object

A Remarkable Page

Contains the metadata, the page itself & thumbnail.

__repr__()

String representation of this object

Return type

str

__str__()

String representation of this object

Return type

str

class rmapy.document.ZipDocument(_id=None, doc=None, file=None)

Bases: object

Here is the content of an archive retried on the tablet as example:

  • 384327f5-133e-49c8-82ff-30aa19f3cfa40.content

  • 384327f5-133e-49c8-82ff-30aa19f3cfa40-metadata.json

  • 384326f5-133e-49c8-82ff-30aa19f3cfa40.rm

  • 384327f5-133e-49c8-82ff-30aa19f3cfa40.pagedata

  • 384327f5-133e-49c8-82ff-30aa19f3cfa40.thumbnails/0.jpg

As the .zip file from remarkable is simply a normal .zip file containing specific file formats, this package is a helper to read and write zip files with the correct format expected by the tablet.

In order to correctly use this package, you will have to understand the format of a Remarkable zip file, and the format of the files that it contains.

You can find some help about the format at the following URL: https://remarkablewiki.com/tech/filesystem

content

Sane defaults for the .content file in the zip.

metadata

parameters describing this blob.

pagedata

the content of the .pagedata file.

zipfile

The raw zipfile in memory.

pdf

the raw pdf file if there is one.

epub

the raw epub file if there is one.

rm

A list of :class:rmapy.document.RmPage in this zip.

ID = None
__repr__()

string representation of this class

Return type

str

__str__()

string representation of this class

Return type

str

content = {'extraMetadata': {}, 'lastOpenedPage': 0, 'lineHeight': -1, 'margins': 180, 'pageCount': 0, 'textScale': 1, 'transform': {}}
create_request()
Return type

Tuple[BytesIO, dict]

dump(file)

Dump the contents of ZipDocument back to a zip file.

This builds a zipfile to upload back to the Remarkable Cloud.

Parameters

file (~BytesOrString) – Where to save the zipfile

Return type

None

epub = None
load(file)

Load a zipfile into this class.

Extracts the zipfile and reads in the contents.

Parameters

file (~BytesOrString) – A string of a file location or a BytesIO instance of a raw zipfile

Return type

None

metadata = {'VissibleName': 'New Document', 'deleted': False, 'lastModified': '1568368808000', 'metadatamodified': False, 'modified': False, 'parent': '', 'pinned': False, 'synced': True, 'type': 'DocumentType', 'version': 1}
pagedata = "b''"
pdf = None
rm = []
zipfile = <_io.BytesIO object>
rmapy.document.from_request_stream(_id, stream)

Return a ZipDocument from a request stream containing a zipfile.

This is used with the BlobGETUrl from a rmapy.document.Document.

Parameters
  • _id (str) – The object ID this zipfile represents.

  • stream (Response) – a stream containing the zipfile.

Return type

ZipDocument

Returns

the object of the downloaded zipfile.

rmapy.document.from_zip(_id, file)

Return A ZipDocument from a zipfile.

Create a ZipDocument instance from a zipfile.

Parameters
  • _id (str) – The object ID this zipfile represents.

  • file (str) – the filename of the zipfile.

Return type

ZipDocument

Returns

An instance of the supplied zipfile.

rmapy.exceptions module

exception rmapy.exceptions.ApiError(msg, response=None)

Bases: Exception

Could not found a requested document

exception rmapy.exceptions.AuthError(msg)

Bases: Exception

Authentication error

exception rmapy.exceptions.DocumentNotFound(msg)

Bases: Exception

Could not found a requested document

exception rmapy.exceptions.FolderNotFound(msg)

Bases: Exception

Could not found a requested folder

exception rmapy.exceptions.UnsupportedTypeError(msg)

Bases: Exception

Not the expected type

rmapy.folder module

class rmapy.folder.Folder(name=None, **kwargs)

Bases: rmapy.meta.Meta

A Meta type of object used to represent a folder.

create_request()

Prepares the necessary parameters to create this folder.

This creates a ZipFolder & the necessary json body to create an upload request.

Return type

Tuple[BytesIO, dict]

update_request()

Prepares the necessary parameters to update a folder.

This sets some parameters in the data structure to submit to the API.

Return type

dict

class rmapy.folder.ZipFolder(_id)

Bases: object

A dummy zipfile to create a folder

This is needed to create a folder on the Remarkable Cloud

rmapy.meta module

class rmapy.meta.Meta(**kwargs)

Bases: object

Meta represents a real object expected in most calls by the remarkable API

This class is used to be subclassed by for new types.

ID

Id of the meta object.

Version

The version of this object.

Success

If the last API Call was a success.

BlobURLGet

The url to get the data blob from. Can be empty.

BlobURLGetExpires

The expiration date of the Get url.

BlobURLPut

The url to upload the data blob to. Can be empty.

BlobURLPutExpires

The expiration date of the Put url.

ModifiedClient

When the last change was by the client.

Type

Currently there are only 2 known types: DocumentType & CollectionType.

VissibleName

The human name of the object.

CurrentPage

The current selected page of the object.

Bookmarked

If the object is bookmarked.

Parent

If empty, this object is is the root folder. This can be an ID of a CollectionType.

BlobURLGet = ''
BlobURLGetExpires = ''
BlobURLPut = ''
BlobURLPutExpires = ''
Bookmarked = False
CurrentPage = 1
ID = ''
Message = ''
ModifiedClient = ''
Parent = ''
Success = True
Type = ''
Version = 0
VissibleName = ''
to_dict()

Return a dict representation of this object.

Used for API Calls.

Returns

a dict of the current object.

Return type

dict

rmapy.types module

Module contents

Note

This is an unofficial api client for the Remarkable Cloud. Use at your own risk.