Skip to content

Proposal for prerender access #1957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions pygeoapi/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,17 +722,8 @@ def _set_content_crs_header(
headers['Content-Crs'] = f'<{content_crs_uri}>'


@jsonldify
def landing_page(api: API,
request: APIRequest) -> Tuple[dict, int, str]:
"""
Provide API landing page

:param request: A request object

:returns: tuple of headers, status code, content
"""

def landing_page_prerender(api: API,
request: APIRequest) -> Tuple[dict, dict]:
fcm = {
'links': [],
'title': l10n.translate(
Expand Down Expand Up @@ -813,6 +804,22 @@ def landing_page(api: API,
}]

headers = request.get_response_headers(**api.api_headers)
return headers, fcm


@jsonldify
def landing_page(api: API,
request: APIRequest) -> Tuple[dict, int, str]:
"""
Provide API landing page

:param request: A request object

:returns: tuple of headers, status code, content
"""

headers, fcm = landing_page_prerender(api, request)

if request.format == F_HTML: # render

for resource_type in ['collection', 'process', 'stac-collection']:
Expand Down