{ "cells": [ { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "import requests\n", "import json\n", "import sys\n", "import os\n", "import xml.etree.ElementTree as ET\n", "import time\n", "import sys\n", "from wpsToolsBox import wpsTB" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "copa_backend_url = \"https://gravitee-gateway.val.esa-maap.org/\"\n", "MAAP_ENV_TYPE = 'val'\n", "user_id ='46874'\n", "CLIENT_ID = '97262f0b-d3ca-4492-bcf8-9a0e12bdede8'\n", "\n", "email = 'algodeveloper1@free.fr'\n", "password = '#4yM@r4K'\n", "\n", "url = \"https://iam.\"+MAAP_ENV_TYPE.lower()+\".esa-maap.org/oxauth/restv1/token\"\n", "response = requests.post(url, data={'client_id': CLIENT_ID, 'username': email, 'password': password, \"grant_type\": \"password\", \"scope\": \"openid+profile\"})\n", "data = json.loads(response.text)\n", "oauth_token = data['access_token']" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "wps = wpsTB(oauth_token, copa_backend_url, user_id)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Service identification ---\n", "Title: WPS COPA layer\n", "Type: WPS 2.0.0\n", " \n", "--- Service Provider ---\n", "Provider: COPA Application caroline.ball@capgemini.com https://copa-backend-val.biomass-maap.com/\n", " \n", "--- Service Operations ---\n", "getCapabilities\n", "execute\n", "getResult\n" ] } ], "source": [ "wps.wps_info()" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- Service Processes ---\n", "There are 12 processes available for execution\n", " \n", "======================================================\n", "|Identifier | Title \n", "======================================================\n", "|5fe1c9ca6d8d6d0001b0e230 | readl2 \n", "------------------------------------------------------\n", "|5ff3301e91db790001274258 | read \n", "------------------------------------------------------\n", "|5fff1388493f610001f5178d | read-s2 \n", "------------------------------------------------------\n", "|5fff1388493f610001f5178b | geocoding \n", "------------------------------------------------------\n", "|5fff1388493f610001f5178a | classification-mask \n", "------------------------------------------------------\n", "|5fff1388493f610001f5178c | s2index \n", "------------------------------------------------------\n", "|5fff1388493f610001f5178e | resample \n", "------------------------------------------------------\n", "|600e8ca13d255d0001aef7c5 | reads2 \n", "------------------------------------------------------\n", "|600ef3b64f4c6300018f2c54 | readstwo \n", "------------------------------------------------------\n", "|6011904643325f0001558fa5 | classificationmask \n", "------------------------------------------------------\n", "|6011904643325f0001558fa6 | indexstwo \n", "------------------------------------------------------\n", "|6037ac45c638e00001484f31 | forestdisturbance \n", "------------------------------------------------------\n" ] } ], "source": [ "wps.wps_processes()" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Title : readstwo\n", "Description : Read the tile\n", "Identifier : 600ef3b64f4c6300018f2c54\n" ] } ], "source": [ "wps.wps_process_info('readstwo')" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- EXECUTE---\n", "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", "<StatusInfo xmlns:xlin=\"http://www.w3.org/1999/xlink\" xmlns:se=\"http://www.opengis.net/se/2.0/core\" xmlns:fes=\"http://www.opengis.net/fes/2.1\" xmlns:ows=\"http://www.opengis.net/ows/2.0\" xmlns:kml=\"http://www.opengis.net/kml/2.2\" xmlns:wps=\"http://www.opengis.net/wps/2.0\" xmlns:ns2=\"http://www.w3.org/2005/Atom\" xmlns:wms=\"http://www.opengis.net/wms\" xmlns:ns3=\"urn:oasis:names:tc:ciq:xsdschema:xAL:2.0\">\n", " <wps:JobID>608a65ffcc45e20001a25288</wps:JobID>\n", " <wps:Status>ACCEPTED</wps:Status>\n", "</StatusInfo>\n", "\n", "\n", "--- EXECUTE---\n", "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", "<StatusInfo xmlns:xlin=\"http://www.w3.org/1999/xlink\" xmlns:se=\"http://www.opengis.net/se/2.0/core\" xmlns:fes=\"http://www.opengis.net/fes/2.1\" xmlns:ows=\"http://www.opengis.net/ows/2.0\" xmlns:kml=\"http://www.opengis.net/kml/2.2\" xmlns:wps=\"http://www.opengis.net/wps/2.0\" xmlns:ns2=\"http://www.w3.org/2005/Atom\" xmlns:wms=\"http://www.opengis.net/wms\" xmlns:ns3=\"urn:oasis:names:tc:ciq:xsdschema:xAL:2.0\">\n", " <wps:JobID>608a6601cc45e20001a2528a</wps:JobID>\n", " <wps:Status>ACCEPTED</wps:Status>\n", "</StatusInfo>\n", "\n", "\n", "--- EXECUTE---\n", "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", "<StatusInfo xmlns:xlin=\"http://www.w3.org/1999/xlink\" xmlns:se=\"http://www.opengis.net/se/2.0/core\" xmlns:fes=\"http://www.opengis.net/fes/2.1\" xmlns:ows=\"http://www.opengis.net/ows/2.0\" xmlns:kml=\"http://www.opengis.net/kml/2.2\" xmlns:wps=\"http://www.opengis.net/wps/2.0\" xmlns:ns2=\"http://www.w3.org/2005/Atom\" xmlns:wms=\"http://www.opengis.net/wms\" xmlns:ns3=\"urn:oasis:names:tc:ciq:xsdschema:xAL:2.0\">\n", " <wps:JobID>608a6602cc45e20001a2528c</wps:JobID>\n", " <wps:Status>ACCEPTED</wps:Status>\n", "</StatusInfo>\n", "\n", "\n", "--- EXECUTE---\n", "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", "<StatusInfo xmlns:xlin=\"http://www.w3.org/1999/xlink\" xmlns:se=\"http://www.opengis.net/se/2.0/core\" xmlns:fes=\"http://www.opengis.net/fes/2.1\" xmlns:ows=\"http://www.opengis.net/ows/2.0\" xmlns:kml=\"http://www.opengis.net/kml/2.2\" xmlns:wps=\"http://www.opengis.net/wps/2.0\" xmlns:ns2=\"http://www.w3.org/2005/Atom\" xmlns:wms=\"http://www.opengis.net/wms\" xmlns:ns3=\"urn:oasis:names:tc:ciq:xsdschema:xAL:2.0\">\n", " <wps:JobID>608a6604cc45e20001a2528e</wps:JobID>\n", " <wps:Status>ACCEPTED</wps:Status>\n", "</StatusInfo>\n", "\n", "\n", "--- EXECUTE---\n", "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", "<StatusInfo xmlns:xlin=\"http://www.w3.org/1999/xlink\" xmlns:se=\"http://www.opengis.net/se/2.0/core\" xmlns:fes=\"http://www.opengis.net/fes/2.1\" xmlns:ows=\"http://www.opengis.net/ows/2.0\" xmlns:kml=\"http://www.opengis.net/kml/2.2\" xmlns:wps=\"http://www.opengis.net/wps/2.0\" xmlns:ns2=\"http://www.w3.org/2005/Atom\" xmlns:wms=\"http://www.opengis.net/wms\" xmlns:ns3=\"urn:oasis:names:tc:ciq:xsdschema:xAL:2.0\">\n", " <wps:JobID>608a6606cc45e20001a25290</wps:JobID>\n", " <wps:Status>ACCEPTED</wps:Status>\n", "</StatusInfo>\n", "\n", "\n", "--- EXECUTE---\n", "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", "<StatusInfo xmlns:xlin=\"http://www.w3.org/1999/xlink\" xmlns:se=\"http://www.opengis.net/se/2.0/core\" xmlns:fes=\"http://www.opengis.net/fes/2.1\" xmlns:ows=\"http://www.opengis.net/ows/2.0\" xmlns:kml=\"http://www.opengis.net/kml/2.2\" xmlns:wps=\"http://www.opengis.net/wps/2.0\" xmlns:ns2=\"http://www.w3.org/2005/Atom\" xmlns:wms=\"http://www.opengis.net/wms\" xmlns:ns3=\"urn:oasis:names:tc:ciq:xsdschema:xAL:2.0\">\n", " <wps:JobID>608a6607cc45e20001a25292</wps:JobID>\n", " <wps:Status>ACCEPTED</wps:Status>\n", "</StatusInfo>\n", "\n", "\n", "FAILED\n", "FAILED\n", "FAILED\n", "FAILED\n", "FAILED\n", "FAILED\n", "Execution time was 122.60012602806091\n" ] }, { "data": { "text/plain": [ "['608a65ffcc45e20001a25288',\n", " '608a6601cc45e20001a2528a',\n", " '608a6606cc45e20001a25290',\n", " '608a6602cc45e20001a2528c',\n", " '608a6604cc45e20001a2528e',\n", " '608a6607cc45e20001a25292']" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "xml_file = '/projects/wps_notebook/xml_file/wps_readstwo.xml'\n", "\n", "wps.wps_execute_process(xml_file, 6)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.4" } }, "nbformat": 4, "nbformat_minor": 4 }