Workspaces
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
|
token copy from polly |
required |
Usage
to initialize a obj
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 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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
name of the workspace |
required |
description |
str
|
general information about workspace |
None
|
Returns:
Type | Description |
---|---|
Dictionary (dict) : It will return an 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 } |
download_from_workspaces(workspace_id, workspace_path)
Function to download files/folders from workspaces.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workspace_id |
int)
|
Id of the where file need to uploaded |
required |
workspace_path |
str)
|
Downloaded file on workspace |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Raises:
Type | Description |
---|---|
InvalidPathException
|
for invalid path |
OperationFailedException
|
when downloading fails |
InvalidParameterException
|
when the parameter like workspace id is invalid |
fetch_my_workspaces()
This function fetch workspaces from Polly.
Returns:
Type | Description |
---|---|
it will return a table with attributes |
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 where file need to uploaded |
required |
workspace_path |
str)
|
file path on workspace if folder does not exist it will create |
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 |