INNER CODE UNIT · Python

fetch_with_retries

crocs-muni/javacard-curated-list · scripts/process_curated_list.py:196

def fetch_with_retries(url, retries=2):
    last_exc = None
    for attempt in range(retries + 1):
        try:
            return fetch_url(url)
        except (HTTPError, URLError, TimeoutError) as e:
            last_exc = e
    raise last_exc


def fetch_repo_badges(owner, repo):
    urls = badge_urls(owner, repo)
    result = {"stars": None, "last_commit_raw": None, "developers": None, "license": None, "error": None}
    try:
        stars_svg = fetch_with_retries(urls["stars"])
        result["stars"] = parse_stars_svg(stars_svg)
    except (HTTPError, URLError, TimeoutError) as e:
        result["error"] = f"stars:{e}"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…