ECCopernicus

How to connect JupyterHub with WEkEO Drive

The WebDAV protocol provides a framework for users to create, share, access and move documents on a server.

This tool can be useful to store your work in the WEkEO Drive, and to share your work between users.

In case you would like to move your files or folders, you can perform these steps:

  1. First, you will need to set up a password for your WEkEO Drive. By clicking your profile at the top right, you can click on the settings. Here, you can go to Security and create a new password for the WEkEO Drive.

    Note: This is not the same password as the WEkEO one.

  2. Create a new Jupyter notebook in your JupyterHub.

  3. Install the package webdavclient3 as shown below:

    !pip install webdavclient3

    This package provides an easy way to work with WebDAV servers.

  4. Then, the configuration of the client is needed. Required keys for configuring client connection with WevDAV server are webdav_hostname and webdav_login, webdav_password.

    from webdav3.client import Client
    options = {
    'webdav_hostname': "<your_webdav_hostname>",
    'webdav_login': "<your_username>",
    'webdav_password': "<your_password>"
    }
    
    client = Client(options)
    client.list()

    The webdav_hostname can be found by clicking Settings at the bottom left of the WEkEO Drive homepage. The webdav_login is the WEkEO username, and webdav_password is the password configured in the first bullet point.

  5. After setting the client, one can upload your files/folders to the WEkEO Drive by just using the following command:

    client.upload_sync(remote_path="<path_JupyterHub>", local_path="<path_WEkEO_Drive>")
  6. Following this, one will see a new file/folder in the WEkEO Drive. If you would like to share it, you can share the link through WEkEO Drive.

  7. In case you would like to perform the inverse approach, you can send data from the WEkEO Drive to the JupyterHub using the following command:

    client.download_sync(remote_path="<path_JupyterHub>", local_path="<path_WEkEO_Drive>")