INNER CODE UNIT · Python

fetch_data

AUNaseef/protonup · protonup/api.py:13

def fetch_data(tag) -> dict:
    """
    Fetch ProtonGE release information from github
    Return Type: dict {str, str}
    Content(s):
        'version', date', 'download', 'size', 'checksum'
    """
    url = PROTONGE_URL + (f'/tags/{tag}' if tag else '/latest')
    data = requests.get(url).json()
    if 'tag_name' not in data:
        return {}  # invalid tag

    values = {'version': data['tag_name'], 'date': data['published_at'].split('T')[0]}
    arch = platform.machine()  # e.g. 'x86_64', 'aarch64'
    # Filter assets matching the current architecture; fall back to all assets
    # if no arch-specific assets exist (older releases).
    arch_assets = [a for a in data['assets'] if arch in a['name']]
    assets = arch_assets if arch_assets else data['assets']

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…