Failed to execute template. Cause: [Access denied when checking [script] access to [xwiki:Collaboratory.UX.HbpSkin.WebHome] for user [xwiki:XWiki.Admin]]. Click on this message for details.

Drive API - HBP Wiki

IAM21 instance, do not create collab nor modify a team, your changes will be lost


Drive API

Last modified by hbpadmin on 2023/05/15 15:16

Abstract

The Collaboratory is using seafile as storage on drive.ebrains.eu

In this tutorial you will found usefull link to help you to interact with the drive from your notebooks or apps.

The ebrains-drive library

HBP and CNRS are working on a python library to access drive feature from python code (including notebooks)

The seafile official REST API

The seafile official rest API provide all the existing endpoint and function usable in seafile. Our library ebrains-drive just simplify its usage by creating specific Collaboratory endpoints. But if you don't found what you need in ebrains-drive function, you can perfectly use ebrains-drive to reach the original API like in this exemple.

import ebrains_drive
from ebrains_drive.client import DriveApiClient

bearer_token = clb_oauth.get_token()
client = ebrains_drive.connect(token=bearer_token)
account_info = client.get('/api2/account/info/').json()

Authentication from python code with username/password

If you are in a notebook environement inside our lab. You should avoid enter any username or password to login with the seafile API. You should process as in the notebook exemple above and use

import ebrains_drive
from ebrains_drive.client import DriveApiClient

bearer_token = clb_oauth.get_token()
client = ebrains_drive.connect(token=bearer_token)

But if you are trying to access drive API from outside our environement, you can use the client created by CNRS and login with your password and credentials.

client = ebrains_drive.connect(username="username", password="password")

This connect function use the validation client created by CNRS. https://validation-v2.brainsimulation.eu/login   

It currently require a Collaboratory 1 account but this should change soon. But this function should not be consider as the standart workflow, it will probably change in the futur as it's not host by The Collaboratory.