INNER CODE UNIT · Python

_get_image_hash

stratumauth/app · extra/generate_icon_meta.py:124

def _get_image_hash(image_url: str) -> Optional[str]:
    res = requests.get(image_url, timeout=REQUEST_TIMEOUT)

    if res.status_code == 404:
        return None

    res.raise_for_status()
    return hashlib.md5(res.content).hexdigest()


def _enrich_metadata_entry(entry: MetadataEntry) -> MetadataEntry:
    if entry["url"] is not None:
        entry["url"] = entry["url"].rstrip("/")

        if entry["name"] is None or entry["image_url"] is None:
            print(
                "Getting icon '"
                + entry["icon"]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…