import requests


def get_releases(url, token):
    """Query releases."""

    if token is not None:
        headers = { 'Authorization': 'token %s' % token }
    else: headers = {}
    r = requests.get(url, headers=headers)
    r.raise_for_status()
    return r.json()