This commit is contained in:
2023-07-14 15:12:10 +08:00
parent 175f52dc0c
commit d7bb7ee7c1
8 changed files with 67 additions and 2 deletions

0
app/__init__.py Normal file
View File

7
app/app.py Normal file
View File

@@ -0,0 +1,7 @@
import falcon
from .images import Resource
app = application = falcon.App()
app.add_route('/images', Resource())

18
app/images.py Normal file
View File

@@ -0,0 +1,18 @@
import falcon
import msgpack
class Resource:
def on_get(self, req, resp):
doc = {
'images': [
{
'href': '/images/1eaf6ef1-7f2d-4ecc-a8d5-6e8adba7cc0e.png',
}
]
}
resp.data = msgpack.packb(doc, use_bin_type=True)
resp.content_type = falcon.MEDIA_MSGPACK
resp.status = falcon.HTTP_200