Skip to content
Snippets Groups Projects
Geneviève Boucher's avatar
Geneviève Boucher authored
Adding print statement when dataset id and datafile id is submitted
Mini change to print statement
c5b966d6
History

pyIRICdata - A python API for interacting with IRIC-data

Install

Load your iric-data py3 virtual environment

module load python/3.6.7
# create your virtual environment if not already installed
python3 -m venv ~/.virtualenvs/iric-data
source ~/.virtualenvs/iric-data/bin/activate

Install

pip install --upgrade pip setuptools wheel
pip install -e .

Examples

from pyiricdata.Client import Client

username = 'test'
password = 'test1234'
url = 'http://127.0.0.1:8000/'

# setup client
client = Client(username, password, url)

# view datasets
client.datasets

# view dataset files
client.get_dataset_filelist(dataset_id='DS12345678')

# download complete dataset
client.dwnl_dataset('DS12345678')

# or just download a single file
client.dwnl_file_content('DF12345678')
client.dwnl_file_annotation('DF12345678')

# upload file (file_path, file_name, lab, dataset, annotations)
file_path = '/home/user/file.txt'
file_name = 'file1'
lab = 'Bioinformatique'
dataset = 'DS12345678'
annotations = {"file_has": "cool_annotation"}

client.file_upload(file_path=file_path, file_name=file_name, lab=lab, dataset=dataset, annotations=annotations)

# update file (file_id, file_name, annotations, lab)
file_id = 'DF12345680'
file_name = 'file1'
lab = 'Bioinformatique'
annotations = {"file_has": "cool_annotation"}

client.file_update(file_id=file_id, file_name=file_name, annotations=annotations, lab=lab)

To run the unittest

python -m unittest discover -v