Skip to content

Commit

Permalink
Create get_workspace_publication_thumbnail method in process_client
Browse files Browse the repository at this point in the history
  • Loading branch information
index-git committed Dec 6, 2023
1 parent 977e56a commit 2f28854
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test_tools/process_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
'patch_workspace_publication_url',
'get_workspace_publications_url',
'get_workspace_publication_url',
'get_workspace_publication_thumbnail_url',
'delete_workspace_publication_url',
'delete_workspace_publications_url',
'keys_to_check',
Expand All @@ -59,6 +60,7 @@
'rest_workspace_map.patch',
'rest_workspace_maps.get',
'rest_workspace_map.get',
'rest_workspace_map_thumbnail.get',
'rest_workspace_map.delete_map',
'rest_workspace_maps.delete',
map_keys_to_check,
Expand All @@ -72,6 +74,7 @@
'rest_workspace_layer.patch',
'rest_workspace_layers.get',
'rest_workspace_layer.get',
'rest_workspace_layer_thumbnail.get',
'rest_workspace_layer.delete_layer',
'rest_workspace_layers.delete',
layer_keys_to_check,
Expand All @@ -91,6 +94,7 @@
None,
None,
None,
None,
),
}

Expand Down Expand Up @@ -738,3 +742,19 @@ def get_workspace_map_file(publication_type, workspace, name, headers=None, acto
response = requests.get(r_url, headers=headers, timeout=HTTP_TIMEOUT)
raise_layman_error(response)
return response.json()


def get_workspace_publication_thumbnail(publication_type, workspace, name, *, actor_name=None):
headers = {}
publication_type_def = PUBLICATION_TYPES_DEF[publication_type]
if actor_name:
assert TOKEN_HEADER not in headers

if actor_name and actor_name != settings.ANONYM_USER:
headers.update(get_authz_headers(actor_name))

with app.app_context():
r_url = url_for(publication_type_def.get_workspace_publication_thumbnail_url, **{publication_type_def.url_param_name: name}, workspace=workspace)
response = requests.get(r_url, headers=headers, timeout=HTTP_TIMEOUT)
raise_layman_error(response)
return response.content

0 comments on commit 2f28854

Please sign in to comment.