update,
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2020-08-18T12:06:29.243603Z",
|
||||
"start_time": "2020-08-18T12:06:29.240780Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"from urllib.parse import parse_qs\n",
|
||||
"import IPython.display"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2020-08-18T12:06:29.250356Z",
|
||||
"start_time": "2020-08-18T12:06:29.246161Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"query_string = os.environ.get('QUERY_STRING', '')\n",
|
||||
"parameters = parse_qs(query_string)\n",
|
||||
"print(\"query string parameters:\", parameters)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2020-08-18T12:06:29.258506Z",
|
||||
"start_time": "2020-08-18T12:06:29.253815Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# parameters is a dict of lists\n",
|
||||
"username = parameters.get('username', ['Kim'])[0]\n",
|
||||
"print(f'Hi {username}')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2020-08-18T12:06:29.275717Z",
|
||||
"start_time": "2020-08-18T12:06:29.261315Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"server = os.environ.get('SERVER_NAME', 'localhost') \n",
|
||||
"url = \"http://\" + server\n",
|
||||
"\n",
|
||||
"port = os.environ.get('SERVER_PORT', '')\n",
|
||||
"if port:\n",
|
||||
" url += \":\" + port\n",
|
||||
"\n",
|
||||
"path = os.environ.get('SCRIPT_NAME', '')\n",
|
||||
"url += path\n",
|
||||
"\n",
|
||||
" \n",
|
||||
"IPython.display.HTML(data=f\"\"\"\n",
|
||||
"<a href=\"{url}?username=Riley\">Link to myself as user Riley</a>\n",
|
||||
"\"\"\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"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.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
Reference in New Issue
Block a user