Package: esper-tool
ESPER TOOLOverviewA python-based command line utility for accessing a device running the ESPER web service. Works with Python 2 and 3.The tool allows for the reading and writing of ESPER variables via the command line.The available subcommands are:interactive_read_write_upload_download_For a list of interactive shell commands typehelpin the interactive shell promptInstallationThe recommended installation method is via pipTo install:pip install esper-toolTo upgrade:pip install -U esper-toolTo run it locally from the github source:python -m esper_toolInteractiveCommand:esper-tool interactive [-h] [-u USER] [-p PASS] [-t TIMEOUT] <url> [mid]Purpose:
Connects to an esper service located aturland opens an interactive shellOptions:-h--helpPrint out help for this subcommand-u USERor--user USERUser to use for HTTP basic authentication-p PASSor--password PASSPassword to use for HTTP basic authentication. If-uis specified, but-pis not, the user will be prompted for a password-t TIMEOUTor--timeout TIMEOUTTime to wait for response before timing out. Can be given in fractions of a second. Defaults to 5 seconds.urlLocation of ESPER web service given in standard web URL format. If the port is excluded, it defaults to 80midModule ID or MID to start in. May be given as numerical value, or module key.ReadCommand:esper-tool read [-h] [-u USER] [-p PASS] [-t TIMEOUT] [-o OFFSET] [-l LEN] <url> <mid> <vid>Purpose:
Read an ESPER variable's data, located at URL. Return value is JSON data typeOptions:-h--helpPrint out help for this subcommand-u USERor--user USERUser to use for HTTP basic authentication-p PASSor--password PASSPassword to use for HTTP basic authentication. If-uis specified, but-pis not, the user will be prompted for a password-t TIMEOUTor--timeout TIMEOUTTime to wait for response before timing out. Can be given in fractions of a second. Defaults to 5 seconds.-o OFFSETor--offset OFFSETElement to start read at within ESPER variable. Defaults to first element (0)-l LENor--len LENNumber of elements to readurlLocation of ESPER web service given in standard web URL format. If the port is excluded, it defaults to 80midModule ID or MID. May be given as numerical value, or module key.vidVariable ID or VID. May be given as numerical value, or variable key.Examples:esper-tool read -o 1 -l 32 localhost:8080 0 0Reads32elements of variable0starting at offset1, atlocalhost:8080module0, variable0WriteCommand:esper-tool write [-h] [-u USER] [-p PASS] [-t TIMEOUT] [-d DATA] [-f FILE] [-o OFFSET] <url> <mid> <vid>Purpose:
Writes JSON data to an ESPER variable. May write the full array or a slice. Data can be specified on the command line or by a fileOptions:-h--helpPrint out help for this subcommand-u USERor--user USERUser to use for HTTP basic authentication-p PASSor--password PASSPassword to use for HTTP basic authentication. If-uis specified, but-pis not, the user will be prompted for a password-t TIMEOUTor--timeout TIMEOUTTime to wait for response before timing out. Can be given in fractions of a second. Defaults to 5 seconds.-d DATAor--data DATAJSON data to write. May take the form of any standard JSON datatype. Datatype must be compatible with ESPER datatype of variable-f FILEor--file FILEFile containing JSON data to be written to variable. Same as-dbut data is written in FILE-o OFFSETor--offset OFFSETElement to start read at within ESPER variable. Defaults to first element (0)urlLocation of ESPER web service given in standard web URL format. If the port is excluded, it defaults to 80midModule ID or MID. May be given as numerical value, or module key.vidVariable ID or VID. May be given as numerical value, or variable key.Examples:esper-tool write -d 255 localhost 1 2Writes the value255to module1, variable2atlocalhostesper-tool write -d [0,2] -o 1 http://localhost:8080 mymodule myvarWrites the array[0,2]to the variablemyvarstarting at the second element. The variable is located in the modulemymoduleon hostlocalhost:8080UploadCommand:esper-tool upload [-h] [-u USER] [-p PASS] [-t TIMEOUT] -f FILE [-r RETRY] <url> <mid> <vid>Purpose:
Upload a binary file to an ESPER variable. Particularly useful for updates to large variable arrays, binary data must match binary format of ESPER variable, or data loaded will be erroneous.Options:-h--helpPrint out help for this subcommand-u USERor--user USERUser to use for HTTP basic authentication-p PASSor--password PASSPassword to use for HTTP basic authentication. If-uis specified, but-pis not, the user will be prompted for a password-t TIMEOUTor--timeout TIMEOUTTime to wait for response before timing out. Can be given in fractions of a second. Defaults to 5 seconds.-f FILEor--file FILEFile containing binary data to be written to variable-r RETRYor--retry RETRYNumber of times to retry if timeout occurs, can be useful if ESPER service connected to is slow to write to disk/flashurlLocation of ESPER web service given in standard web URL format. If the port is excluded, it defaults to 80midModule ID or MID. May be given as numerical value, or module key.vidVariable ID or VID. May be given as numerical value, or variable key.Examples:esper-tool upload -v --file ~/waveform.bin -r 3 http://localhost:80/ 5 waveform_replayUploads the contents of filewaveform.bintolocalhostmodule5, variablewaveform_replay. It will retry3times in the event of failureDownloadCommand:esper-tool download [-h] [-u USER] [-p PASS] [-t TIMEOUT] -f FILE [-r RETRY] <url> <mid> <vid>Purpose:
Downloads variable data to a binary file.Options:-h--helpPrint out help for this subcommand-u USERor--user USERUser to use for HTTP basic authentication-p PASSor--password PASSPassword to use for HTTP basic authentication. If-uis specified, but-pis not, the user will be prompted for a password-t TIMEOUTor--timeout TIMEOUTTime to wait for response before timing out. Can be given in fractions of a second. Defaults to 5 seconds.-f FILEor--file FILELocation of file to write variable data to-r RETRYor--retry RETRYNumber of times to retry if timeout occurs, can be useful if ESPER service connected to is slow to write to disk/flashurlLocation of ESPER web service given in standard web URL format. If the port is excluded, it defaults to 80midModule ID or MID. May be given as numerical value, or module key.vidVariable ID or VID. May be given as numerical value, or variable key.Examples:esper-tool download -v --file ~/waveform.bin -r 3 http://localhost:80/ 5 waveform_replayDownload the contents of filelocalhostmodule5, variablewaveform_replaytowaveform.bin. It will retry3times in the event of failure