Added support for downloading binary
This commit is contained in:
@@ -1,13 +1,25 @@
|
||||
from logging import Logger
|
||||
|
||||
if False:
|
||||
from .connection import Connection
|
||||
|
||||
|
||||
LOGGER = Logger(__name__)
|
||||
|
||||
|
||||
class SimpleNode:
|
||||
def __init__(self, path: str, data: dict, connection: 'Connection'):
|
||||
self.path = path
|
||||
self._data = data
|
||||
self._connection = connection
|
||||
|
||||
def download(self, key: str = 'jcr:data') -> bytes:
|
||||
if ':' + key not in self._data:
|
||||
LOGGER.warning(f"Key :{key} is not present, binary probably not available")
|
||||
# TODO value of the :{key} must be an int
|
||||
# TODO value denotes file size, warn/deny large files?
|
||||
return self._connection.download_binary(self.path + '/' + key)
|
||||
|
||||
def __getitem__(self, item):
|
||||
return getattr(self, item)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user