Skip to content

Commit

Permalink
add get_response to wis2box_api
Browse files Browse the repository at this point in the history
  • Loading branch information
maaikelimper committed Jan 24, 2025
1 parent aa203e2 commit 7ff2d5d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
20 changes: 20 additions & 0 deletions wis2box_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,24 @@
#
###############################################################################

from flask import make_response

__version__ = 'wis2box-1.0b8'


def get_response(result: tuple):
"""
Creates a Flask Response object and updates matching headers.
:param result: The result of the API call.
This should be a tuple of (headers, status, content).
:returns: A Response instance
"""

headers, status, content = result
response = make_response(content, status)

if headers:
response.headers = headers
return response
3 changes: 2 additions & 1 deletion wis2box_api/flask_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@

from flask import Blueprint, request

from pygeoapi.flask_app import get_response
from pygeoapi.util import yaml_load

from wis2box_api import get_response
from wis2box_api.admin import Admin


LOGGER = logging.getLogger(__name__)

CONFIG = None
Expand Down
2 changes: 1 addition & 1 deletion wis2box_api/flask_asyncapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

from flask import Blueprint, request

from pygeoapi.flask_app import get_response
from pygeoapi.util import yaml_load

from wis2box_api import get_response
from wis2box_api.asyncapi import AsyncAPI

LOGGER = logging.getLogger(__name__)
Expand Down

0 comments on commit 7ff2d5d

Please sign in to comment.