Data class documentation¶
Data class¶
- class apreshttp.Data(api_obj)¶
- __init__(api_obj)¶
Assign instance of the
APIclassAPIChild should inherently be a child of an
APIobject hence the constructor requires an instance ofAPIto meet this conditions.- Parameters
api_obj (apreshttp.API) – instance of
API
- dir(path='', startIndex=0, listSize=16)¶
Get a directory listing from the path specified
Returns a
apreshttp.Data.DirectoryListingobject representing the files and directories in the specified path.If there are more than listSize=16 (default) files in the directory, the returned list will be truncated and the total number of objects in the directory stored in numObjectsInDir.
To request the next ‘page’ of objects in the directory. make another call to dir with startIndex=N*listSize, where N is the desired ‘page number’.
- Raises
ValueError – if path is not a string object
NotFoundException – if the path is not found on the ApRES file system
NotADirectoryError – if the path does not point to a directory
InternalRadarErrorException – if an internal radar error has occured.
- Returns
object containing descriptions of files and subdirectories.
- Return type
- download(path, dst_path=None)¶
Download a file to the working dir or the destination path
If the file at path exists on the ApRES filesystem, it will be downloaded to either the current working directory (if dst_path is None).
Alternatively, providing a dst_path value that refers to a directory will download the file to that directory, using its name on the ApRES filesystem.
Providing a dst_path value that refers to a file will download the file to that path.
NOTE: If the destination filepath already exists, a FileExistsException will be thrown.
- Parameters
path (str) – path on the ApRES filesystem of the file to download
dst_path (str) – destination path to download file to
- Raises
FileExistsException – if the file already exists at dst_path
DirectoryListing class¶
- class apreshttp.Data.DirectoryListing(resp_json)¶
Represents files stored on the ApRES SD card
- __init__(resp_json)¶
Create a new DirectoryListing from parsed JSON data
- directories¶
List of directory objects (
apreshttp.Data.FileObject)
- files¶
List of file objects (
apreshttp.Data.FileObject)
- load(resp_json)¶
- numObjectsInDir¶
Number of files in directory
- numObjectsInList¶
Number of files in listing
- path¶
Root path of directory
FileObject class¶
- class apreshttp.Data.FileObject(resp_json)¶
Class to represent files or directories on the ApRES file system
- __init__(resp_json)¶
Initialize self. See help(type(self)) for accurate signature.
- download(api, dst_path=None)¶
Download the file to the working dir or the destination path
See the documentation for
apreshttp.Data.download()- Parameters
api (apreshttp.API) – instance of the apreshttp API
dst_path (str) – destination path to download file to