2020-04-03 22:28:25 +02:00
|
|
|
# views_api.py is for you API endpoints that could be hit by another service
|
2020-02-20 00:21:01 +01:00
|
|
|
|
2020-04-03 22:28:25 +02:00
|
|
|
# add your dependencies here
|
2020-02-20 00:21:01 +01:00
|
|
|
|
2020-04-03 22:28:25 +02:00
|
|
|
# import json
|
2020-10-08 21:03:18 +02:00
|
|
|
# import httpx
|
|
|
|
# (use httpx just like requests, except instead of response.ok there's only the
|
|
|
|
# response.is_error that is its inverse)
|
2020-04-03 22:28:25 +02:00
|
|
|
|
2020-09-14 02:31:05 +02:00
|
|
|
from quart import jsonify
|
2020-05-03 15:57:05 +02:00
|
|
|
from http import HTTPStatus
|
2020-04-03 22:28:25 +02:00
|
|
|
|
2020-11-21 22:04:39 +01:00
|
|
|
from . import example_ext
|
2020-02-20 00:21:01 +01:00
|
|
|
|
|
|
|
|
2020-04-03 22:28:25 +02:00
|
|
|
# add your endpoints here
|
|
|
|
|
2020-08-31 04:19:43 +02:00
|
|
|
|
2020-04-03 22:28:25 +02:00
|
|
|
@example_ext.route("/api/v1/tools", methods=["GET"])
|
2020-09-14 02:31:05 +02:00
|
|
|
async def api_example():
|
2020-02-20 00:21:01 +01:00
|
|
|
"""Try to add descriptions for others."""
|
2020-04-03 22:28:25 +02:00
|
|
|
tools = [
|
2020-11-22 03:23:11 +01:00
|
|
|
{
|
2020-12-02 11:45:12 +01:00
|
|
|
"name": "Quart",
|
|
|
|
"url": "https://pgjones.gitlab.io/quart/",
|
2020-11-22 03:23:11 +01:00
|
|
|
"language": "Python",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "Vue.js",
|
|
|
|
"url": "https://vuejs.org/",
|
|
|
|
"language": "JavaScript",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "Quasar Framework",
|
|
|
|
"url": "https://quasar.dev/",
|
|
|
|
"language": "JavaScript",
|
|
|
|
},
|
2020-04-03 22:28:25 +02:00
|
|
|
]
|
|
|
|
|
2020-05-03 15:57:05 +02:00
|
|
|
return jsonify(tools), HTTPStatus.OK
|