Gen3 Workspace Storage

class gen3.wss.Gen3WsStorage(auth_provider=None)[source]

Bases: object

A class for interacting with the Gen3 workspace storage service.

Examples

This generates the Gen3WsStorage class pointed at the sandbox commons while using the credentials.json downloaded from the commons profile page.

>>> auth = Gen3Auth(endpoint, refresh_file="credentials.json")
... wss = Gen3WsStorage(auth)
copy(src_urlstr, dest_urlstr)[source]

Parse src_urlstr and dest_urlstr, and call upload or download as appropriate

download(src_ws, src_wskey, dest_path)[source]

Download a file from the workspace to local disk

Parameters
  • src_ws (string) – name of the workspace

  • src_wskey (string) – key of the object in the workspace

  • dest_path (string) – to download the file to

download_url(ws, wskey)[source]

Get a download url for the given workspace key

Parameters
  • ws (string) – name of the workspace

  • wskey (string) – key of the object in the workspace

ls(ws, wskey)[source]

List the contents under the given workspace path

Parameters
  • ws (string) – name of the workspace

  • wskey (string) – key of the object in the workspace

ls_path(ws_urlstr)[source]
Same as ls - but parses ws_urlstr argument of form:

ws:///workspace/key

Parameters
  • ws (string) – name of the workspace

  • wskey (string) – key of the object in the workspace

rm(ws, wskey)[source]

Remove the given workspace key

Parameters
  • ws (string) – name of the workspace

  • wskey (string) – key of the object in the workspace

rm_path(ws_urlstr)[source]

Same as rm - but parses the ws_urlstr argument

upload(src_path, dest_ws, dest_wskey)[source]

Upload a local file to the specified workspace path

upload_url(ws, wskey)[source]

Get a upload url for the given workspace key

Parameters
  • ws (string) – name of the workspace

  • wskey (string) – key of the object in the workspace