Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardKoschicek committed Sep 26, 2023
1 parent f8db20f commit d6a7a8f
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions openatlas/api/endpoints/iiif.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Any

import requests
from flask import request, jsonify, Response
from flask_restful import Resource
Expand All @@ -7,7 +9,7 @@
from openatlas import app


def getManifest(id_):
def get_manifest(id_: int) -> dict[str, Any]:
entity = get_entity_by_id(id_)
url_root = app.config['IIIF_URL'] or f"{request.url_root}iiif/"
# get metadata from the image api
Expand Down Expand Up @@ -55,24 +57,17 @@ def getManifest(id_):
"@context":
"http://iiif.io/api/image/2/context.json",
"@id": iiif_id,
"profile": image_api['profile']
},
"profile": image_api['profile']},
"height": image_api['height'],
"width": image_api['width']},
"on": "http://251a31df-761d-46df-85c3-66cb967b8a67"}],
"related": ""}]}],
"structures": []}


return manifest


class IIIFManifest(Resource):
@staticmethod
def get(id_: int) -> Response:
# content = gzip.compress(json.dumps(getManifest(id_)).encode(
# 'utf8'), 5)
# response = Response(content)
# response.headers['Content-length'] = len(content)
# response.headers['Content-Encoding'] = 'gzip'
return jsonify(getManifest(id_))
return jsonify(get_manifest(id_))

0 comments on commit d6a7a8f

Please sign in to comment.