Warning:  Due to planned infrastructure maintenance, the EBRAINS Wiki and EBRAINS Support system will be unavailable for up to three days starting Monday, 14 July. During this period, both services will be inaccessible, and any emails sent to the support address will not be received.

Attention: We are currently experiencing some issues with the EBRAINS Drive. Please bear with us as we fix this issue. We apologise for any inconvenience caused.


Version 2.1 by chaney08 on 2021/06/22 19:34

Show last authors
1 You can use the URL query parameters to add environment variables to a jupyter notebook.
2
3 For example, here is a link to a notebook:
4
5 https:~/~/lab.ebrains.eu/user-redirect/lab/tree/shared/example_path/notebook.ipynb
6
7 To add environment variables that are accessible within that notebook (in this case LAB_MY_VARIABLE) use this URL:
8
9 https:~/~/lab.ebrains.eu/user-redirect/lab/tree/shared/example_path/notebook.ipynb**?LAB_MY_VARIABLE=Hello**
10
11 You can add as many variables as you want but the query string needs to be properly formatted. You can find more info about the query string format [[here>>https://en.wikipedia.org/wiki/Query_string]].
12
13 //Note**:** For the query parameters to be accessible in the notebook they needs to be prefixed with LAB_ e.g. ?LAB_MY_VARIABLE=4 //
14
15 To access a environment variable in the notebook you can use this snipped:
16
17 {{code}}
18 import os
19 os.environ.get('LAB_MY_VARIABLE')
20 {{/code}}
21
22