diff --git a/notebooks/paysage_api_test.ipynb b/notebooks/paysage_api_test.ipynb index 429e887..7a60833 100644 --- a/notebooks/paysage_api_test.ipynb +++ b/notebooks/paysage_api_test.ipynb @@ -2,25 +2,103 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 30, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ + "import os\n", "import requests\n", - "import pandas as pd" + "\n", + "import pandas as pd\n", + "from dotenv import load_dotenv\n", + "\n", + "load_dotenv()" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "url = \"https://paysage-api.staging.dataesr.ovh/relations?limit=10000&filters[relationTag]=structure-categorie&filters[relatedObjectId]=mCpLW\"\n", + "headers = {\"X-API-KEY\": os.getenv(\"PAYSAGE_API_KEY\")}\n", + "\n", + "response = requests.get(url, headers=headers)" ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'mCpLW'" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "response.json().get(\"data\")[0].get(\"relatedObjectId\")" + ] + }, + { + "cell_type": "code", + "execution_count": 45, "metadata": {}, "outputs": [], "source": [ - "url = \"https://paysage-api.staging.dataesr.ovh/relations?limit=10000&filters[relationTag]=structure-categorie&filters[relatedObjectId]=mCpLW&filters[relatedObjectId]=Eg7tX&filters[relatedObjectId]=93BR1&filters[relatedObjectId]=2ZdzP&filters[relatedObjectId]=MTFHZ&filters[relatedObjectId]=UfEnK&filters[relatedObjectId]=Sv5bb&filters[relatedObjectId]=mNJ1Z&filters[relatedObjectId]=WCat8&filters[relatedObjectId]=fQ6GL&filters[relatedObjectId]=WkSgR&filters[relatedObjectId]=YNqFb&filters[relatedObjectId]=iyn79&filters[relatedObjectId]=NsMkU\"\n", - "headers = {\"X-API-KEY\": \"xkeypsg-72b39GvylkDPoEe6AwUz\"}\n", + "id = \"m7K6T\"\n", + "url = f\"https://paysage-api.staging.dataesr.ovh/structures/{id}\"\n", + "url = f\"https://paysage-api.staging.dataesr.ovh/relations?limit=100&filters[relationTag]=structure-categorie&filters[resourceId]={id}\"\n", + "headers = {\"X-API-KEY\": os.getenv(\"PAYSAGE_API_KEY\")}\n", "\n", "response = requests.get(url, headers=headers)" ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'usualNameFr': 'Université',\n", + " 'priority': 1,\n", + " 'id': 'mCpLW',\n", + " 'displayName': 'Université',\n", + " 'collection': 'categories',\n", + " 'href': '/categories/mCpLW',\n", + " 'usualNameEn': None,\n", + " 'descriptionFr': None,\n", + " 'descriptionEn': None}" + ] + }, + "execution_count": 62, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "response.json().get(\"data\")[16].get(\"relatedObject\")" + ] } ], "metadata": { diff --git a/project/client/dist/index.html b/project/client/dist/index.html index 3ce0bb9..79a8906 100644 --- a/project/client/dist/index.html +++ b/project/client/dist/index.html @@ -6,7 +6,7 @@