Notebooks - MOSI

This commit is contained in:
Fabio Sinibaldi 2022-04-28 17:17:08 +02:00
parent 1b7658315c
commit 8e6b1e0106
4 changed files with 1361 additions and 195 deletions

View File

@ -0,0 +1,175 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "c31f6b90-0ce8-4f90-a29d-0dc50c1496a0",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
"# Common Utilities"
]
},
{
"cell_type": "markdown",
"id": "83f8676a-8a81-44d8-82ad-8b3ab638467d",
"metadata": {},
"source": [
"## Common libraries"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "2dc4873b-9de5-442e-9902-2113414155eb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: simplejson in /opt/conda/lib/python3.9/site-packages (3.17.6)\n",
"Requirement already satisfied: rich[jupyter] in /opt/conda/lib/python3.9/site-packages (12.2.0)\n",
"Requirement already satisfied: pygments<3.0.0,>=2.6.0 in /opt/conda/lib/python3.9/site-packages (from rich[jupyter]) (2.11.2)\n",
"Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in /opt/conda/lib/python3.9/site-packages (from rich[jupyter]) (0.9.1)\n",
"Requirement already satisfied: ipywidgets<8.0.0,>=7.5.1 in /opt/conda/lib/python3.9/site-packages (from rich[jupyter]) (7.7.0)\n",
"Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (5.2.0)\n",
"Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.0)\n",
"Requirement already satisfied: widgetsnbextension~=3.6.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (3.6.0)\n",
"Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (5.1.1)\n",
"Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.1.0)\n",
"Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (8.2.0)\n",
"Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (6.11.0)\n",
"Requirement already satisfied: matplotlib-inline>=0.1 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.1.3)\n",
"Requirement already satisfied: jupyter-client>=6.1.12 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (7.2.1)\n",
"Requirement already satisfied: tornado>=6.1 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (6.1)\n",
"Requirement already satisfied: psutil in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (5.9.0)\n",
"Requirement already satisfied: nest-asyncio in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.5.5)\n",
"Requirement already satisfied: setuptools>=60 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (61.3.1)\n",
"Requirement already satisfied: debugpy>=1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.5.1)\n",
"Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.7.5)\n",
"Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.0)\n",
"Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (5.1.1)\n",
"Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (3.0.27)\n",
"Requirement already satisfied: stack-data in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.0)\n",
"Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.8.0)\n",
"Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.18.1)\n",
"Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.4.0)\n",
"Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.9.2)\n",
"Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (6.4.10)\n",
"Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.8.3)\n",
"Requirement already satisfied: attrs>=17.4.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (21.4.0)\n",
"Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.18.1)\n",
"Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.4)\n",
"Requirement already satisfied: pyzmq>=22.3 in /opt/conda/lib/python3.9/site-packages (from jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (22.3.0)\n",
"Requirement already satisfied: python-dateutil>=2.8.2 in /opt/conda/lib/python3.9/site-packages (from jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.8.2)\n",
"Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.13.3)\n",
"Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (3.1.1)\n",
"Requirement already satisfied: Send2Trash>=1.8.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.8.0)\n",
"Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.13.1)\n",
"Requirement already satisfied: nbconvert>=5 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (6.4.5)\n",
"Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (21.3.0)\n",
"Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.7.0)\n",
"Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.5)\n",
"Requirement already satisfied: executing in /opt/conda/lib/python3.9/site-packages (from stack-data->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.8.3)\n",
"Requirement already satisfied: asttokens in /opt/conda/lib/python3.9/site-packages (from stack-data->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.0.5)\n",
"Requirement already satisfied: pure-eval in /opt/conda/lib/python3.9/site-packages (from stack-data->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.2)\n",
"Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.5.0)\n",
"Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.6.0)\n",
"Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.1.1)\n",
"Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.8.4)\n",
"Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.7.1)\n",
"Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.1.2)\n",
"Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.1.0)\n",
"Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.5.13)\n",
"Requirement already satisfied: beautifulsoup4 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.10.0)\n",
"Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.9/site-packages (from python-dateutil>=2.8.2->jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.16.0)\n",
"Requirement already satisfied: argon2-cffi-bindings in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (21.2.0)\n",
"Requirement already satisfied: cffi>=1.0.1 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi-bindings->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.15.0)\n",
"Requirement already satisfied: soupsieve>1.2 in /opt/conda/lib/python3.9/site-packages (from beautifulsoup4->nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.3.1)\n",
"Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (21.3)\n",
"Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.5.1)\n",
"Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.21)\n",
"Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (3.0.7)\n"
]
}
],
"source": [
"import requests\n",
"\n",
"!pip install simplejson\n",
"import simplejson as json\n",
"\n",
"## Import Rich text support for pretty json \n",
"!pip install rich[jupyter]\n",
"import rich\n",
"from rich import print_json"
]
},
{
"cell_type": "markdown",
"id": "6bb61aa9-4ead-46c5-973b-f4b966eeb62d",
"metadata": {},
"source": [
"## Utility Functions"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "fd543e29-59fe-4c83-8892-658244a2df43",
"metadata": {},
"outputs": [],
"source": [
"## Define utility function for HTTP requests logging\n",
"def send(dest,data=None,method=\"GET\",params={}):\n",
" if verbose : print(\"GOING TO SEND \"+method+\" REQUEST TO \"+dest)\n",
" headers={\n",
" 'Content-type':'application/json', \n",
" 'Accept':'*/*',\n",
" 'gcube-token':gcube_token\n",
" }\n",
" if data is not None : print(\"Data is \"+str(data))\n",
" if method == \"GET\" : response = requests.get(url=dest,params=params,headers=headers)\n",
" if method == \"PUT\" : response = requests.put(url=dest,data=data,params=params,headers=headers)\n",
" if method == \"POST\" : response = requests.post(url=dest,data=data,params=params,headers=headers)\n",
" if method == \"DELETE\" : response = requests.delete(url=dest,data=data,params=params,headers=headers)\n",
" if verbose : print(\"RESPONSE STATUS \"+str(response.status_code)) \n",
" if response.status_code<200 or response.status_code>=300 : \n",
" if verbose :print(\"CAUSE \"+str(response.reason))\n",
" if verbose :print(response.text)\n",
" return json.loads(response.text)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "96e527eb-7ebd-4c64-824a-edfd52349320",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -4,7 +4,6 @@
"cell_type": "markdown",
"id": "64e0639b-c024-49eb-93ef-3c67539dec34",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
@ -47,62 +46,90 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "fcc15ae5-fc3f-4146-b77c-bf23231c9ae6",
"metadata": {
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: simplejson in /opt/conda/lib/python3.9/site-packages (3.17.6)\n",
"Requirement already satisfied: rich[jupyter] in /opt/conda/lib/python3.9/site-packages (12.2.0)\n",
"Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in /opt/conda/lib/python3.9/site-packages (from rich[jupyter]) (0.9.1)\n",
"Requirement already satisfied: pygments<3.0.0,>=2.6.0 in /opt/conda/lib/python3.9/site-packages (from rich[jupyter]) (2.11.2)\n",
"Requirement already satisfied: ipywidgets<8.0.0,>=7.5.1 in /opt/conda/lib/python3.9/site-packages (from rich[jupyter]) (7.7.0)\n",
"Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.1.0)\n",
"Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.0)\n",
"Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (5.2.0)\n",
"Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (5.1.1)\n",
"Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (8.2.0)\n",
"Requirement already satisfied: widgetsnbextension~=3.6.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (3.6.0)\n",
"Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (6.11.0)\n",
"Requirement already satisfied: jupyter-client>=6.1.12 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (7.2.1)\n",
"Requirement already satisfied: tornado>=6.1 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (6.1)\n",
"Requirement already satisfied: psutil in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (5.9.0)\n",
"Requirement already satisfied: setuptools>=60 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (61.3.1)\n",
"Requirement already satisfied: matplotlib-inline>=0.1 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.1.3)\n",
"Requirement already satisfied: debugpy>=1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.5.1)\n",
"Requirement already satisfied: nest-asyncio in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.5.5)\n",
"Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.8.0)\n",
"Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.18.1)\n",
"Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.0)\n",
"Requirement already satisfied: stack-data in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.0)\n",
"Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.7.5)\n",
"Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (5.1.1)\n",
"Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (3.0.27)\n",
"Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.4.0)\n",
"Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.9.2)\n",
"Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (6.4.10)\n",
"Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.8.3)\n",
"Requirement already satisfied: attrs>=17.4.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (21.4.0)\n",
"Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.18.1)\n",
"Requirement already satisfied: python-dateutil>=2.8.2 in /opt/conda/lib/python3.9/site-packages (from jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.8.2)\n",
"Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.4)\n",
"Requirement already satisfied: pyzmq>=22.3 in /opt/conda/lib/python3.9/site-packages (from jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (22.3.0)\n",
"Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.13.3)\n",
"Requirement already satisfied: Send2Trash>=1.8.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.8.0)\n",
"Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (3.1.1)\n",
"Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (21.3.0)\n",
"Requirement already satisfied: nbconvert>=5 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (6.4.5)\n",
"Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.13.1)\n",
"Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.7.0)\n",
"Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.5)\n",
"Requirement already satisfied: asttokens in /opt/conda/lib/python3.9/site-packages (from stack-data->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.0.5)\n",
"Requirement already satisfied: executing in /opt/conda/lib/python3.9/site-packages (from stack-data->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.8.3)\n",
"Requirement already satisfied: pure-eval in /opt/conda/lib/python3.9/site-packages (from stack-data->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.2)\n",
"Requirement already satisfied: beautifulsoup4 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.10.0)\n",
"Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.1.0)\n",
"Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.8.4)\n",
"Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.5.13)\n",
"Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.1.1)\n",
"Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.6.0)\n",
"Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.7.1)\n",
"Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.1.2)\n",
"Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.5.0)\n",
"Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.9/site-packages (from python-dateutil>=2.8.2->jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.16.0)\n",
"Requirement already satisfied: argon2-cffi-bindings in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (21.2.0)\n",
"Requirement already satisfied: cffi>=1.0.1 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi-bindings->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.15.0)\n",
"Requirement already satisfied: soupsieve>1.2 in /opt/conda/lib/python3.9/site-packages (from beautifulsoup4->nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.3.1)\n",
"Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.5.1)\n",
"Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (21.3)\n",
"Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.21)\n",
"Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (3.0.7)\n"
]
}
],
"source": [
"import requests\n",
"import json\n",
"\n",
"# These parameters should be discovered / initialized by common gcube libraries. \n",
"gcube_token = \"...\"\n",
"service_base_endpoint =\"https://geoportal.dev.int.d4science.net/geoportal-service/srv\"\n",
"\n",
"# Actual customizable parameters\n",
"ucid = \"basic\"\n",
"\n",
"\n",
"#NB The following should not be changed \n",
"projects_endpoint = service_base_endpoint + \"/projects/\"+ucid\n",
"ucd_endpoint = service_base_endpoint + \"/ucd/\"\n",
"plugins_endpoint=service_base_endpoint + \"/plugins/\"\n",
"\n",
"\n",
"## Import Rich text support for pretty json \n",
"!pip install rich[jupyter]\n",
"import rich\n",
"from rich import print_json\n",
"\n",
"## Define utility function for HTTP requests logging\n",
"def send(dest,data=None,method=\"GET\",params={}):\n",
" print(\"GOING TO SEND \"+method+\" REQUEST TO \"+dest)\n",
" headers={\n",
" 'Content-type':'application/json', \n",
" 'Accept':'*/*',\n",
" 'gcube-token':gcube_token\n",
" }\n",
" if data is not None : print(\"Data is \"+str(data))\n",
" if method == \"GET\" : response = requests.get(url=dest,params=params,headers=headers)\n",
" if method == \"PUT\" : response = requests.put(url=dest,data=data,params=params,headers=headers)\n",
" if method == \"POST\" : response = requests.post(url=dest,data=data,params=params,headers=headers)\n",
" if method == \"DELETE\" : response = requests.delete(url=dest,data=data,params=params,headers=headers)\n",
" print(\"RESPONSE STATUS \"+str(response.status_code)) \n",
" if response.status_code<200 or response.status_code>=300 : \n",
" print(\"CAUSE \"+str(response.reason))\n",
" print(response.text)\n",
" return json.loads(response.text)\n",
"\n",
"#print(send(method=\"GET\",dest=\"http://geoportal.dev.int.d4science.net/geoportal-service/srv/mongo-concessioni/\"))"
"%run commons.ipynb"
]
},
{
"cell_type": "markdown",
"id": "2b565fd2-4884-4a01-a6f7-300ea8fd7028",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
@ -160,7 +187,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "1cf34b3e-56ca-43c7-8206-3e16cebb80e0",
"metadata": {},
"outputs": [],
@ -171,10 +198,124 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "ba665887-9718-44ee-be51-62283fa2dbb2",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"GOING TO SEND POST REQUEST TO https://geoportal.dev.int.d4science.net/geoportal-service/srv/projects/basic\n",
"Data is {\"myTitle\": \"Some Big Title\"}\n",
"RESPONSE STATUS 200\n",
"Resulting project is \n"
]
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_id\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"625042b202ad3d6126dfe5b5\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_version\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"1.0.0\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_info\"</span>: <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_creationInfo\"</span>: <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_user\"</span>: <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_username\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"FAKE\"</span>\n",
" <span style=\"font-weight: bold\">}</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_context\"</span>: <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_id\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"/gcube/devsec/devVRE\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_name\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"/devVRE\"</span>\n",
" <span style=\"font-weight: bold\">}</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_instant\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"2022-04-08T16:12:01.449\"</span>\n",
" <span style=\"font-weight: bold\">}</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_lastEditInfo\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_access\"</span>: <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_policy\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"OPEN\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_license\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"\"</span>\n",
" <span style=\"font-weight: bold\">}</span>\n",
" <span style=\"font-weight: bold\">}</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_profileID\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"basic\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_profileVersion\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"1.0.0\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_lifecycleInformation\"</span>: <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_phase\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"DRAFT\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_lastInvokedStep\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_lastOperationStatus\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"OK\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_errorMessages\"</span>: <span style=\"font-weight: bold\">[]</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_warningMessages\"</span>: <span style=\"font-weight: bold\">[]</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_triggeredEvents\"</span>: <span style=\"font-weight: bold\">[</span>\n",
" <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"event\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"INIT_DOCUMENT\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"lastOperationStatus\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"OK\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"errorMessages\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"warningMessages\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>\n",
" <span style=\"font-weight: bold\">}</span>\n",
" <span style=\"font-weight: bold\">]</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_notes\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>\n",
" <span style=\"font-weight: bold\">}</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_relationships\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_spatialReference\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_temporalReference\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_theDocument\"</span>: <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"myTitle\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"Some Big Title\"</span>\n",
" <span style=\"font-weight: bold\">}</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_lock\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"_id\"\u001b[0m: \u001b[32m\"625042b202ad3d6126dfe5b5\"\u001b[0m,\n",
" \u001b[1;34m\"_version\"\u001b[0m: \u001b[32m\"1.0.0\"\u001b[0m,\n",
" \u001b[1;34m\"_info\"\u001b[0m: \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"_creationInfo\"\u001b[0m: \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"_user\"\u001b[0m: \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"_username\"\u001b[0m: \u001b[32m\"FAKE\"\u001b[0m\n",
" \u001b[1m}\u001b[0m,\n",
" \u001b[1;34m\"_context\"\u001b[0m: \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"_id\"\u001b[0m: \u001b[32m\"/gcube/devsec/devVRE\"\u001b[0m,\n",
" \u001b[1;34m\"_name\"\u001b[0m: \u001b[32m\"/devVRE\"\u001b[0m\n",
" \u001b[1m}\u001b[0m,\n",
" \u001b[1;34m\"_instant\"\u001b[0m: \u001b[32m\"2022-04-08T16:12:01.449\"\u001b[0m\n",
" \u001b[1m}\u001b[0m,\n",
" \u001b[1;34m\"_lastEditInfo\"\u001b[0m: \u001b[3;35mnull\u001b[0m,\n",
" \u001b[1;34m\"_access\"\u001b[0m: \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"_policy\"\u001b[0m: \u001b[32m\"OPEN\"\u001b[0m,\n",
" \u001b[1;34m\"_license\"\u001b[0m: \u001b[32m\"\"\u001b[0m\n",
" \u001b[1m}\u001b[0m\n",
" \u001b[1m}\u001b[0m,\n",
" \u001b[1;34m\"_profileID\"\u001b[0m: \u001b[32m\"basic\"\u001b[0m,\n",
" \u001b[1;34m\"_profileVersion\"\u001b[0m: \u001b[32m\"1.0.0\"\u001b[0m,\n",
" \u001b[1;34m\"_lifecycleInformation\"\u001b[0m: \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"_phase\"\u001b[0m: \u001b[32m\"DRAFT\"\u001b[0m,\n",
" \u001b[1;34m\"_lastInvokedStep\"\u001b[0m: \u001b[3;35mnull\u001b[0m,\n",
" \u001b[1;34m\"_lastOperationStatus\"\u001b[0m: \u001b[32m\"OK\"\u001b[0m,\n",
" \u001b[1;34m\"_errorMessages\"\u001b[0m: \u001b[1m[\u001b[0m\u001b[1m]\u001b[0m,\n",
" \u001b[1;34m\"_warningMessages\"\u001b[0m: \u001b[1m[\u001b[0m\u001b[1m]\u001b[0m,\n",
" \u001b[1;34m\"_triggeredEvents\"\u001b[0m: \u001b[1m[\u001b[0m\n",
" \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"event\"\u001b[0m: \u001b[32m\"INIT_DOCUMENT\"\u001b[0m,\n",
" \u001b[1;34m\"lastOperationStatus\"\u001b[0m: \u001b[32m\"OK\"\u001b[0m,\n",
" \u001b[1;34m\"errorMessages\"\u001b[0m: \u001b[3;35mnull\u001b[0m,\n",
" \u001b[1;34m\"warningMessages\"\u001b[0m: \u001b[3;35mnull\u001b[0m\n",
" \u001b[1m}\u001b[0m\n",
" \u001b[1m]\u001b[0m,\n",
" \u001b[1;34m\"_notes\"\u001b[0m: \u001b[3;35mnull\u001b[0m\n",
" \u001b[1m}\u001b[0m,\n",
" \u001b[1;34m\"_relationships\"\u001b[0m: \u001b[3;35mnull\u001b[0m,\n",
" \u001b[1;34m\"_spatialReference\"\u001b[0m: \u001b[3;35mnull\u001b[0m,\n",
" \u001b[1;34m\"_temporalReference\"\u001b[0m: \u001b[3;35mnull\u001b[0m,\n",
" \u001b[1;34m\"_theDocument\"\u001b[0m: \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"myTitle\"\u001b[0m: \u001b[32m\"Some Big Title\"\u001b[0m\n",
" \u001b[1m}\u001b[0m,\n",
" \u001b[1;34m\"_lock\"\u001b[0m: \u001b[3;35mnull\u001b[0m\n",
"\u001b[1m}\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project= send(method=\"POST\",dest=projects_endpoint,data=json.dumps(doc))\n",
"\n",
@ -206,12 +347,30 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "2b0076fa-0ab5-44a5-b069-2fdc0d6d70be",
"metadata": {
"tags": []
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"myTitle\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"Some Big Title\"</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"myTitle\"\u001b[0m: \u001b[32m\"Some Big Title\"\u001b[0m\n",
"\u001b[1m}\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"print_json(data=project[\"_theDocument\"])"
]
@ -230,12 +389,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "8e2fd339-4117-49d4-9a3c-d9463d35ba2d",
"metadata": {
"tags": []
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008000; text-decoration-color: #008000\">\"625042b202ad3d6126dfe5b5\"</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[32m\"625042b202ad3d6126dfe5b5\"\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"print_json(data=project[\"_id\"])"
]
@ -257,12 +430,58 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "228daf3a-ec36-403c-84f4-dc7ff1fde026",
"metadata": {
"tags": []
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_creationInfo\"</span>: <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_user\"</span>: <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_username\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"FAKE\"</span>\n",
" <span style=\"font-weight: bold\">}</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_context\"</span>: <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_id\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"/gcube/devsec/devVRE\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_name\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"/devVRE\"</span>\n",
" <span style=\"font-weight: bold\">}</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_instant\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"2022-04-08T16:12:01.449\"</span>\n",
" <span style=\"font-weight: bold\">}</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_lastEditInfo\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_access\"</span>: <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_policy\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"OPEN\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_license\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"\"</span>\n",
" <span style=\"font-weight: bold\">}</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"_creationInfo\"\u001b[0m: \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"_user\"\u001b[0m: \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"_username\"\u001b[0m: \u001b[32m\"FAKE\"\u001b[0m\n",
" \u001b[1m}\u001b[0m,\n",
" \u001b[1;34m\"_context\"\u001b[0m: \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"_id\"\u001b[0m: \u001b[32m\"/gcube/devsec/devVRE\"\u001b[0m,\n",
" \u001b[1;34m\"_name\"\u001b[0m: \u001b[32m\"/devVRE\"\u001b[0m\n",
" \u001b[1m}\u001b[0m,\n",
" \u001b[1;34m\"_instant\"\u001b[0m: \u001b[32m\"2022-04-08T16:12:01.449\"\u001b[0m\n",
" \u001b[1m}\u001b[0m,\n",
" \u001b[1;34m\"_lastEditInfo\"\u001b[0m: \u001b[3;35mnull\u001b[0m,\n",
" \u001b[1;34m\"_access\"\u001b[0m: \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"_policy\"\u001b[0m: \u001b[32m\"OPEN\"\u001b[0m,\n",
" \u001b[1;34m\"_license\"\u001b[0m: \u001b[32m\"\"\u001b[0m\n",
" \u001b[1m}\u001b[0m\n",
"\u001b[1m}\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"print_json(data=project[\"_info\"])"
]
@ -288,12 +507,56 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "d2059a6e-b1a5-484a-a48e-16158d6015d5",
"metadata": {
"tags": []
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_phase\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"DRAFT\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_lastInvokedStep\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_lastOperationStatus\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"OK\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_errorMessages\"</span>: <span style=\"font-weight: bold\">[]</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_warningMessages\"</span>: <span style=\"font-weight: bold\">[]</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_triggeredEvents\"</span>: <span style=\"font-weight: bold\">[</span>\n",
" <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"event\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"INIT_DOCUMENT\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"lastOperationStatus\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"OK\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"errorMessages\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"warningMessages\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>\n",
" <span style=\"font-weight: bold\">}</span>\n",
" <span style=\"font-weight: bold\">]</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_notes\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"_phase\"\u001b[0m: \u001b[32m\"DRAFT\"\u001b[0m,\n",
" \u001b[1;34m\"_lastInvokedStep\"\u001b[0m: \u001b[3;35mnull\u001b[0m,\n",
" \u001b[1;34m\"_lastOperationStatus\"\u001b[0m: \u001b[32m\"OK\"\u001b[0m,\n",
" \u001b[1;34m\"_errorMessages\"\u001b[0m: \u001b[1m[\u001b[0m\u001b[1m]\u001b[0m,\n",
" \u001b[1;34m\"_warningMessages\"\u001b[0m: \u001b[1m[\u001b[0m\u001b[1m]\u001b[0m,\n",
" \u001b[1;34m\"_triggeredEvents\"\u001b[0m: \u001b[1m[\u001b[0m\n",
" \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"event\"\u001b[0m: \u001b[32m\"INIT_DOCUMENT\"\u001b[0m,\n",
" \u001b[1;34m\"lastOperationStatus\"\u001b[0m: \u001b[32m\"OK\"\u001b[0m,\n",
" \u001b[1;34m\"errorMessages\"\u001b[0m: \u001b[3;35mnull\u001b[0m,\n",
" \u001b[1;34m\"warningMessages\"\u001b[0m: \u001b[3;35mnull\u001b[0m\n",
" \u001b[1m}\u001b[0m\n",
" \u001b[1m]\u001b[0m,\n",
" \u001b[1;34m\"_notes\"\u001b[0m: \u001b[3;35mnull\u001b[0m\n",
"\u001b[1m}\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"print_json(data=project[\"_lifecycleInformation\"])"
]
@ -370,7 +633,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "4323986d-218f-4997-9fe0-c9ba9e3e3c84",
"metadata": {},
"outputs": [],
@ -384,10 +647,43 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"id": "6123e5e5-9150-47bd-a49a-b2bc21915d34",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"GOING TO SEND PUT REQUEST TO https://geoportal.dev.int.d4science.net/geoportal-service/srv/projects/basic/625042b202ad3d6126dfe5b5\n",
"Data is {\"myTitle\": \"My newer edited title\", \"section\": {\"sectionTitle\": \"My new SubSection\"}}\n",
"RESPONSE STATUS 200\n"
]
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"myTitle\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"My newer edited title\"</span>,\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"section\"</span>: <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"sectionTitle\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"My new SubSection\"</span>\n",
" <span style=\"font-weight: bold\">}</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"myTitle\"\u001b[0m: \u001b[32m\"My newer edited title\"\u001b[0m,\n",
" \u001b[1;34m\"section\"\u001b[0m: \u001b[1m{\u001b[0m\n",
" \u001b[1;34m\"sectionTitle\"\u001b[0m: \u001b[32m\"My new SubSection\"\u001b[0m\n",
" \u001b[1m}\u001b[0m\n",
"\u001b[1m}\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# NB uncomment to actually perform edit\n",
"project = send(method=\"PUT\",data=json.dumps(doc),dest=projects_endpoint+\"/\"+str(project[\"_id\"]))\n",
@ -437,7 +733,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"id": "07965581-532d-45e8-bbf8-0bbec1a15273",
"metadata": {},
"outputs": [],
@ -463,10 +759,37 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"id": "832e043c-870b-4509-be92-d90865cfd105",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"GOING TO SEND POST REQUEST TO https://geoportal.dev.int.d4science.net/geoportal-service/srv/projects/basic/registerFiles/625042b202ad3d6126dfe5b5\n",
"Data is {\"fieldDefinitionPath\": \"$.section._children[?(@.fileset)]\", \"parentPath\": \"$.section\", \"fieldName\": \"fileset\", \"streams\": [{\"url\": \"https://www.cnr.it/sites/all/themes/custom/cnr03_theme/img/cnrlogo.svg\", \"filename\": \"myLogo.svg\"}]}\n",
"RESPONSE STATUS 500\n",
"CAUSE \n",
"<!doctype html><html lang=\"en\"><head><title>HTTP Status 500 Internal Server Error</title><style type=\"text/css\">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 Internal Server Error</h1><hr class=\"line\" /><p><b>Type</b> Status Report</p><p><b>Message</b> Internal Server Error</p><p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.</p><hr class=\"line\" /><h3>Apache Tomcat/8.5.39 (Ubuntu)</h3></body></html>\n"
]
},
{
"ename": "JSONDecodeError",
"evalue": "Expecting value: line 1 column 1 (char 0)",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mJSONDecodeError\u001b[0m Traceback (most recent call last)",
"Input \u001b[0;32mIn [11]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0m project \u001b[38;5;241m=\u001b[39m \u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mPOST\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43mdest\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mprojects_endpoint\u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m/registerFiles/\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mproject\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m_id\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43mdata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mjson\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdumps\u001b[49m\u001b[43m(\u001b[49m\u001b[43mregisterFilesetRequest\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mOur Registered FileSet\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 4\u001b[0m print_json(data\u001b[38;5;241m=\u001b[39mproject[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_theDocument\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msection\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfileset\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n",
"Input \u001b[0;32mIn [1]\u001b[0m, in \u001b[0;36msend\u001b[0;34m(dest, data, method, params)\u001b[0m\n\u001b[1;32m 38\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCAUSE \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m+\u001b[39m\u001b[38;5;28mstr\u001b[39m(response\u001b[38;5;241m.\u001b[39mreason))\n\u001b[1;32m 39\u001b[0m \u001b[38;5;28mprint\u001b[39m(response\u001b[38;5;241m.\u001b[39mtext)\n\u001b[0;32m---> 40\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mjson\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mloads\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtext\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/opt/conda/lib/python3.9/json/__init__.py:346\u001b[0m, in \u001b[0;36mloads\u001b[0;34m(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)\u001b[0m\n\u001b[1;32m 341\u001b[0m s \u001b[38;5;241m=\u001b[39m s\u001b[38;5;241m.\u001b[39mdecode(detect_encoding(s), \u001b[38;5;124m'\u001b[39m\u001b[38;5;124msurrogatepass\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 343\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\u001b[38;5;28mcls\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m object_hook \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m\n\u001b[1;32m 344\u001b[0m parse_int \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m parse_float \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m\n\u001b[1;32m 345\u001b[0m parse_constant \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m object_pairs_hook \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m kw):\n\u001b[0;32m--> 346\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_default_decoder\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdecode\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 347\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mcls\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 348\u001b[0m \u001b[38;5;28mcls\u001b[39m \u001b[38;5;241m=\u001b[39m JSONDecoder\n",
"File \u001b[0;32m/opt/conda/lib/python3.9/json/decoder.py:337\u001b[0m, in \u001b[0;36mJSONDecoder.decode\u001b[0;34m(self, s, _w)\u001b[0m\n\u001b[1;32m 332\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdecode\u001b[39m(\u001b[38;5;28mself\u001b[39m, s, _w\u001b[38;5;241m=\u001b[39mWHITESPACE\u001b[38;5;241m.\u001b[39mmatch):\n\u001b[1;32m 333\u001b[0m \u001b[38;5;124;03m\"\"\"Return the Python representation of ``s`` (a ``str`` instance\u001b[39;00m\n\u001b[1;32m 334\u001b[0m \u001b[38;5;124;03m containing a JSON document).\u001b[39;00m\n\u001b[1;32m 335\u001b[0m \n\u001b[1;32m 336\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 337\u001b[0m obj, end \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mraw_decode\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43midx\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m_w\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mend\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 338\u001b[0m end \u001b[38;5;241m=\u001b[39m _w(s, end)\u001b[38;5;241m.\u001b[39mend()\n\u001b[1;32m 339\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m end \u001b[38;5;241m!=\u001b[39m \u001b[38;5;28mlen\u001b[39m(s):\n",
"File \u001b[0;32m/opt/conda/lib/python3.9/json/decoder.py:355\u001b[0m, in \u001b[0;36mJSONDecoder.raw_decode\u001b[0;34m(self, s, idx)\u001b[0m\n\u001b[1;32m 353\u001b[0m obj, end \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mscan_once(s, idx)\n\u001b[1;32m 354\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[0;32m--> 355\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m JSONDecodeError(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mExpecting value\u001b[39m\u001b[38;5;124m\"\u001b[39m, s, err\u001b[38;5;241m.\u001b[39mvalue) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28mNone\u001b[39m\n\u001b[1;32m 356\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m obj, end\n",
"\u001b[0;31mJSONDecodeError\u001b[0m: Expecting value: line 1 column 1 (char 0)"
]
}
],
"source": [
"project = send(method=\"POST\",dest=projects_endpoint+\"/registerFiles/\"+str(project[\"_id\"]),data=json.dumps(registerFilesetRequest))\n",
"\n",
@ -519,11 +842,10 @@
"id": "e288d77d-70f6-48bc-b78b-16e673d38100",
"metadata": {},
"source": [
"Once our request is ready we can send it to server with a <strong>POST</strong> request at <em>SERVICE_BASE_ENDPOINT</em>/projects/UCID/step/<strong>STEPID/<\\strong><strong>ID</strong> where:\\\n",
"Once our request is ready we can send it to server with a <strong>POST</strong> request at <em>SERVICE_BASE_ENDPOINT</em>/projects/UCID/step/<strong>ID</strong> where:\\\n",
"- SERVICE_BASE_ENDPOINT should be discovered from the infrastructure's Information System\n",
"- UCID is the ID of the Use Case Descriptor to be used with this project\n",
"- ID is our project Unique Identifier\n",
"- ID is our project Unique Identifier\n",
"\n",
"Depending on implementations and configurations, invoked STEP may expect/require some additional parameters.\\\n",
"These can be specified in the request body as a simple JSON object.\n",
@ -997,7 +1319,6 @@
"cell_type": "markdown",
"id": "4e9068c1-2a16-4890-8f4d-9966c0352f0c",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
@ -1024,7 +1345,6 @@
"cell_type": "markdown",
"id": "13fe4942-e7cb-4590-b76d-5d8448041eae",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
@ -1302,6 +1622,8 @@
"version": "3.9.10"
},
"toc-autonumbering": true,
"toc-showcode": false,
"toc-showmarkdowntxt": false,
"toc-showtags": false
},
"nbformat": 4,

View File

@ -0,0 +1,169 @@
{
"CD" : {
"TSK" : row.TSK,
"CMD" : row.CMD,
"ESC" : row.ESC,
"ECP" : row.ECP,
"CBC" : row.CBC,
"ACC" : {
"ACCE" : row.ACCE,
"ACCC" : row.ACCC,
"ACCS" : row.ACCS
}
},
"OG" : {
"AMB" : row.AMB,
"AMA" : row.AMA,
"OGD": row.OGD,
"OGT" : row.OGT,
"OGN" : row.OGN
},
"LC" : {
"LCS" : row.LCS,
"LCR" : row.LCR,
"LCP" : row.LCP,
"LCC" : row.LCC,
"LCI" : row.LCI,
"PVL" : row.PVL,
"PVZ" : row.PVZ,
"ACB" : {
"ACBA" : row.ACBA,
"ACBS" : row.ACBS
}
},
"DT" : {
"DTR" : row.DTR,
"DTT" : row.DTT
},
"DA" : {
"DES" : row.DES,
"OGM": row.OGM
},
"GE" : {
"GEL" : row.GEL,
"GET" : row.GET,
"GEP" : row.GEP,
"GEC" : {
"GECX" : row.GECX,
"GECY" : row.GECY
},
"GPT": row.GPT,
"GPM": row.GPM,
"GPB" : {
"GPBB" : row.GPBB
}
},
"TU" : {
"CDG": {
"CDGG": row.CDGG
},
"BPT" : row.BPT,
"NVC": {
"NVCT" : row.NVCT,
"NVCM" : row.NVCM,
"NVCE" : row.NVCE,
"NVCP" : row.NVCP,
"NWCN" : row.NWCN
},
"STU":{
"STUE" : row.STUE,
"STUT" : row.STUT,
"STUS" : row.STUS
}
},
"RE" : {
"RCG": {
"RCGV" : row.RCGV,
"RCGD" : row.RCGD,
"RCGT" : row.RCGT,
"RCGE" : row.RCGE
},
"MTP" : {
"MTPC": row.MTPC,
"MTPZ" : row.MTPZ
},
"MTZ" : row.MTZ,
"FOI" : {
"FOIT" : row.FOIT,
"FOIR" : row.FOIR,
"FOIA" : row.FOIA,
"FOIQ" : row.FOIQ,
"FOIF" : row.FOIF,
"FOIO" : row.FOIO,
"FOIN" : row.FOIN
}
},
"IP" : {
"IAP" : {
"IAPN" : row.IAPN,
"IAPR" : row.IAPR,
"IAPI" : row.IAPI,
"IAPS" : row.IAPS
}
},
"MT" : {
"MIS" : {
"MISZ" : row.MISZ,
"MISU" : row.MISU,
"MISM" : row.MISM
},
"MTA" : {
"MTAP" : row.MTAP,
"MTAM" : row.MTAM,
"MTAX" : row.MTAX,
"MTAR" : row.MTAR,
"MTAS" : row.MTAS
}
},
"VR" : {
"VRP" : {
"VRPI" : row.VRPI,
"VRPA" : row.VRPA,
"VRPV" : row.VRPV,
"VRPS" : row.VRPS,
"VRPN" : row.VRPN
},
"VRR" : {
"VRRP" : row.VRRP,
"VRRO" : row.VRRO,
"VRRR" : row.VRRR,
"VRRS" : row.VRRS,
"VRRN" : row.VRRN
}
},
"DO" : {
"FTA" : {
"FTAN" : row.FTAN,
"FTAX" : row.FTAX,
"FTAP" : row.FTAP,
"FTAC" : row.FTAC
},
"DRA" : {
"DRAN" : row.DRAN,
"DRAX" : row.DRAX,
"DRAT" : row.DRAT,
"DRAC" : row.DRAC,
"DRAK" : row.DRAK
},
"FNT" : {
"FNTI" : row.FNTI,
"FNTX" : row.FNTX,
"FNTP" : row.FNTP,
"FNTS" : row.FNTS,
"FNTK" : row.FNTK
},
"BIB" : {
"BIBR" : row.BIBR,
"BIBX" : row.BIBX,
"BIBM" : row.BIBM,
"BIBN" : row.BIBN
}
},
"CM" : {
"FUR" : row.FUR,
"CMR" : row.CMR,
"CMC" : row.CMC,
"CMA" : row.CMA,
"ADP" : row.ADP
}
}

File diff suppressed because one or more lines are too long