linkahead.utils.server_side_scripting module

server_side_scripting

Helper functions for calling server-side scripts.

class linkahead.utils.server_side_scripting.ScriptingResponse(call, code, stdout, stderr)

Bases: object

A data class for the response of server-side scripting calls.

Properties

codeint

The return code of the script process.

callstr

The complete call of the script minus the absolute path and the auth_token.

stdoutstr

The STDOUT of the script process.

stderrstr

The STDERR of the script process.

linkahead.utils.server_side_scripting.run_server_side_script(call, *args, files=None, **kwargs)
Parameters:
  • call (str) – name of the script to be called, potentially with path prefix (e.g. management/update.py)

  • *args (list(str)) – list of positional arguments

  • files (dict) – dictionary with where keys are the argument names with prefix (e.g. -p1 or -Ofile) and the values are the paths to the files to be uploaded. Note, that only the base name will be used when uploaded. Files will be placed in the .upload_files folder. Thus, the script will be called with the argument <key>=.upload_files/<basename>.

  • **kwargs (dict) – kwargs will be passed to _make_request

Returns:

response

Return type:

ScriptingResponse