Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/utils.py
Show First 20 Lines • Show All 441 Lines • ▼ Show 20 Lines | |||||
def get_deposit_raw_metadata(deposit_id: int) -> Optional[str]: | def get_deposit_raw_metadata(deposit_id: int) -> Optional[str]: | ||||
cache_key = f"swh-deposit-raw-metadata-{deposit_id}" | cache_key = f"swh-deposit-raw-metadata-{deposit_id}" | ||||
metadata = cache.get(cache_key) | metadata = cache.get(cache_key) | ||||
if metadata is None: | if metadata is None: | ||||
config = get_config()["deposit"] | config = get_config()["deposit"] | ||||
url = f"{config['private_api_url']}/{deposit_id}/meta" | url = f"{config['private_api_url']}/{deposit_id}/meta" | ||||
metadata = requests.get(url).json()["metadata_raw"] | metadata = requests.get(url).json()["raw_metadata"] | ||||
cache.set(cache_key, metadata) | cache.set(cache_key, metadata) | ||||
return metadata | return metadata | ||||
def origin_visit_types() -> List[str]: | def origin_visit_types() -> List[str]: | ||||
"""Return the exhaustive list of visit types for origins | """Return the exhaustive list of visit types for origins | ||||
ingested into the archive. | ingested into the archive. | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |