diff --git a/examples/demo6/python/notebook/MEC application.ipynb b/examples/demo6/python/notebook/MEC application.ipynb index c19b9722f5bc37c45481f6e24ad1f8a84b977626..6d3e3877c57bdf2dcc5cd7f1ecd1f7a6a0449b15 100644 --- a/examples/demo6/python/notebook/MEC application.ipynb +++ b/examples/demo6/python/notebook/MEC application.ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "# How to develop a MEC application using the MEC Sandbox HTTP REST API\n", - "This tutorial introduces the step by step procedure to create a basic MEC appcation following ETSI MEC standards.\n", + "This tutorial introduces the step by step procedure to create a basic MEC application following ETSI MEC standards.\n", "It uses the ETSI MEC Sandbox simulator.\n", "\n", "
\n", @@ -334,8 +334,8 @@ "metadata": {}, "outputs": [], "source": [ - "#%%script echo skipping\n", - "# Uncomment the ;line above to skip execution of this cell\n", + "%%script echo skipping\n", + "# Uncomment the line above to skip execution of this cell\n", "def process_main():\n", " \"\"\"\n", " This is the skeleton of our MEC application:\n", @@ -441,7 +441,7 @@ "metadata": {}, "outputs": [], "source": [ - "#%%script echo skipping\n", + "%%script echo skipping\n", "# Uncomment the ;line above to skip execution of this cell\n", "def process_main():\n", " \"\"\"\n", @@ -621,7 +621,7 @@ "metadata": {}, "outputs": [], "source": [ - "#%%script echo skipping\n", + "%%script echo skipping\n", "# Uncomment the ;line above to skip execution of this cell\n", "def process_main():\n", " \"\"\"\n", @@ -841,7 +841,7 @@ "metadata": {}, "outputs": [], "source": [ - "#%%script echo skipping\n", + "%%script echo skipping\n", "# Uncomment the ;line above to skip execution of this cell\n", "def process_main():\n", " \"\"\"\n", @@ -1233,7 +1233,7 @@ "metadata": {}, "outputs": [], "source": [ - "#%%script echo skipping\n", + "%%script echo skipping\n", "# Uncomment the ;line above to skip execution of this cell\n", "def process_main():\n", " \"\"\"\n", @@ -1502,7 +1502,7 @@ "metadata": {}, "outputs": [], "source": [ - "#%%script echo skipping\n", + "%%script echo skipping\n", "# Uncomment the ;line above to skip execution of this cell\n", "def process_main():\n", " \"\"\"\n", @@ -1663,7 +1663,7 @@ "metadata": {}, "outputs": [], "source": [ - "#%%script echo skipping\n", + "%%script echo skipping\n", "# Uncomment the ;line above to skip execution of this cell\n", "def process_main():\n", " \"\"\"\n", @@ -1749,13 +1749,13 @@ " logger.info('do_GET: ' + ctype)\n", "\n", " message = ''\n", - " if self.path == '/statistic/v1/quantity':\n", + " if self.path == '/sandbox/v1/statistic/v1/quantity':\n", " logger.info('do_GET: Computing statistic quantities for application MEC service')\n", " # TODO Add logit to our MEC service\n", " message = '{\"time\":20180124,\"avg\": 0.0,\"max\": 0.0,\"min\": 0.0,\"stddev\": 0.0 }'\n", " else:\n", - " # Send message back to client\n", - " message = bytes(str(self.headers) + \"\\n\" +self.requestline +\"\\n\", 'utf8')\n", + " # Send error message\n", + " message = '{\"title\":\"Unknown URI\",\"type\":\"do_GET.parser\",\"status\":404 }'\n", " logger.info('do_GET: message: ' + message)\n", " \n", " # Send response status code\n", @@ -1767,7 +1767,7 @@ " self.end_headers()\n", "\n", " # Write content as utf-8 data\n", - " self.wfile.write(message)\n", + " self.wfile.write(message.encode('utf8'))\n", " return\n", " # End of function do_GET\n", "\n", @@ -1929,7 +1929,7 @@ }, "outputs": [], "source": [ - "#%%script echo skipping\n", + "%%script echo skipping\n", "# Uncomment the ;line above to skip execution of this cell\n", "def process_main():\n", " \"\"\"\n", @@ -2077,7 +2077,7 @@ "metadata": {}, "outputs": [], "source": [ - "#%%script echo skipping\n", + "%%script echo skipping\n", "# Uncomment the ;line above to skip execution of this cell\n", "def process_main():\n", " \"\"\"\n", @@ -2545,7 +2545,7 @@ "metadata": {}, "outputs": [], "source": [ - "#%%script echo skipping\n", + "%%script echo skipping\n", "# Uncomment the ;line above to skip execution of this cell\n", "def process_main():\n", " \"\"\"\n", @@ -2614,7 +2614,7 @@ "metadata": {}, "outputs": [], "source": [ - "#%%script echo skipping\n", + "%%script echo skipping\n", "# Uncomment the ;line above to skip execution of this cell\n", "def process_main():\n", " \"\"\"\n", @@ -3485,7 +3485,7 @@ "metadata": {}, "outputs": [], "source": [ - "#%%script echo skipping\n", + "%%script echo skipping\n", "# Uncomment the ;line above to skip execution of this cell\n", "def process_main():\n", " \"\"\"\n", @@ -4511,7 +4511,7 @@ " data = json.loads(result.data)\n", " logger.info('data: %s', str(data))\n", " logger.info('=============> Execute the command: curl --request GET %s/statistic/v1/quantity --header \"Accept: application/json\" --data \\'{\"time\":20180124,\"data1\":\"[1516752000,11590.6,11616.9,11590.4,11616.9,0.25202387,1516752060,11622.4,11651.7,11622.4,11644.6,1.03977764]\"}\\'', CALLBACK_URI)\n", - " time.sleep(45)\n", + " time.sleep(60)\n", "\n", " # Stop notification server\n", " stop_notification_server(httpd)\n", @@ -4667,7 +4667,7 @@ "metadata": {}, "outputs": [], "source": [ - "#%%script echo skipping\n", + "%%script echo skipping\n", "# Uncomment the ;line above to skip execution of this cell\n", "def process_main():\n", " \"\"\"\n",