import requests


def get_json(name, *args, **kwargs):
    """Retrieve JSON from a (REST) API server after checking correct response."""
    r = requests.get(*args, **kwargs)
    assert r.ok, "%s access failed: %s" % (name, r.reason)
    return r.json()