Skip to content

Workspaces

This class contains functions to interact with workspaces on Polly. Users can create a workspace, fetch list of workspaces, upload data to workspace and download data from workspace. To get started, users need to initialize a object that can use all function and methods of Workspaces class.

Parameters:

Name Type Description Default
token str

Authentication token from polly

None
Usage

from polly.Workspaces import Workspaces

workspaces = Workspaces(token)

create_copy(source_id, source_path, destination_id, destination_path='')

Function to create a copy of files/folders existing in a workspace into another workspace.

Parameters:

Name Type Description Default
source_id int

workspace id of the source workspace where the file/folder exists

required
source_path str)

file/folder path on the source workspace to be copied

required
destination_id int)

workspace id of the destination workspace where the file/folder is to be copied

required
destination_path str, optional)

optional parameter to specify the destination path

''

Raises:

Type Description
InvalidParameterException

when the parameter like source id is invalid

InvalidPathException

when the source path is invalid

create_workspace(name, description=None)

This function create workspace on Polly. Returns a Dictionary object like this { 'id': 9999, 'name': 'rrrrr', 'active': True, 'description': 'for docu', 'created_time': '2022-03-16 11:08:47.127260', 'last_modified': '2022-03-16 11:08:47.127260', 'creator': 1127, 'project_property': { 'type': 'workspaces', 'labels': '' }, 'organisation': 1 }

Parameters:

Name Type Description Default
name str

name of the workspace

required
description str

general information about workspace

None

download_from_workspaces(workspace_id, workspace_path)

Function to download files/folders from workspaces. A message will be displayed on the status of the operation.

Parameters:

Name Type Description Default
workspace_id int)

Id of the workspace where file needs to uploaded

required
workspace_path str)

Downloaded file on workspace

required

Returns:

Type Description
None

None

Raises:

Type Description
InvalidPathException

Invalid file path provided

OperationFailedException

Failed download

InvalidParameterException

Invalid parameter passed

fetch_my_workspaces()

This function fetch workspaces from Polly.

Returns:

Type Description

A table with workspace specific attributes

list_contents(workspace_id)

This function fetches contents of a workspace from Polly.

Args: | workspace_id : workspace id for the target workspace.

Returns: | it will return a table with attributes.

.. code::

    # create a obj
    workspaces = Workspaces(token)
    # from there you can other methods
    workspaces.list_contents(workspace_id)

upload_to_workspaces(workspace_id, workspace_path, local_path)

Function to upload files/folders to workspaces.

Parameters:

Name Type Description Default
workspace_id int)

id of the workspace where file need to uploaded

required
workspace_path str)

path where the file is to be uploaded.

required
local_path str)

uploaded file path

required

Raises:

Type Description
InvalidParameterException

when the parameter like workspace id is invalid

InvalidPathException

when the file to path is invalid

Examples