Skip to content

Commit

Permalink
Merge pull request #317 from City-of-Helsinki/HEL-347-all-photos-from…
Browse files Browse the repository at this point in the history
…-finna

fix: read all photo urls from Finna response
  • Loading branch information
jannetalvio committed Feb 29, 2024
2 parents a05a08d + 4fb4c72 commit 969c1e5
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions hkm/finna.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class FinnaClient(object):
IMAGE_REPO_ENDPOINT = "https://museoliittorepox.vserver.fi/mpthumbnailhelper/download?id={identifier}&size={size}&key=T3st1" # noqa: E501
API_ENDPOINT = "https://api.finna.fi/v1/"
DOWNLOAD_ENDPOINT = "https://finna.fi/"
timeout = 10
Expand Down Expand Up @@ -236,21 +235,13 @@ def _get_finna_result(self, url, payload):
return result_data

def get_thumbnail_image_url(self, record):
if identifier := self.get_identifier(record):
return FinnaClient.IMAGE_REPO_ENDPOINT.format(
identifier=identifier, size="medium"
)
return None
return self.get_labeled_image_url(record, "small")

def get_image_url(self, record_id):
return f"https://finna.fi/Cover/Show?id={record_id}&fullres=1&index=0"

def get_full_res_image_url(self, record):
if identifier := self.get_identifier(record):
return FinnaClient.IMAGE_REPO_ENDPOINT.format(
identifier=identifier, size="extra_extra_large"
)
return None
return self.get_original_image_url(record)

def get_original_image_url(self, record):
# attempt to find high resolution original photo url
Expand Down

0 comments on commit 969c1e5

Please sign in to comment.