Ejemplo n.º 1
0
    def backup(self, output=None):
        """\
Create a backup of the current system configuration

Optional:
output   : Path or file handle (string or file-like object)
"""
        path = api_path_by_module(self)
        if output:
            return self._connection.download(path, stream_output(output))
        return self._connection.download(path, raw_output)
Ejemplo n.º 2
0
    def download(self, output=None, query=None):
        """\
Download the signatures. Defaults to all if no query is provided.

Optional:
output  : Path or file handle. (string or file-like object)
query   : lucene query (string)

If output is not specified the content is returned.
"""
        path = api_path_by_module(self, **get_function_kwargs('output', 'self'))
        if output:
            return self._connection.download(path, stream_output(output))
        return self._connection.download(path, raw_output)
Ejemplo n.º 3
0
    def create(self, sid, output=None):
        """\
Creates a bundle containing the submission results and the associated files

Required:
sid    : Submission ID (string)

Optional:
output  : Path or file handle. (string or file-like object)

If output is not specified the content is returned by the function
"""
        path = api_path('bundle', sid)

        if output:
            return self._connection.download(path, stream_output(output))
        return self._connection.download(path, raw_output)
Ejemplo n.º 4
0
    def download(self, sha256, encoding=None, sid=None, output=None):
        """\
Download the file with the given sha256.

Required:
sha256     : File key (string)

Optional:
encoding : Which file encoding do you want for the file (string)
output   : Path or file handle (string or file-like object)
sid      : ID of the submission the download is for
           If carted the file will inherit the submission metadata (string)

If output is not specified the content is returned.

Throws a Client exception if the file does not exist.
"""
        kw = get_function_kwargs('output', 'self', 'sha256')
        path = api_path_by_module(self, sha256, **kw)
        if output:
            return self._connection.download(path, stream_output(output))
        return self._connection.download(path, raw_output)