import requests


def get_json(url, payload=None, verbose=True):
    """ Get JSON from an online service with optimal URL parameters. """
    r = requests.get(url, params=payload)
    if verbose:
        print("Fetched: {}".format(r.url))
    if r.status_code != 200:
        print("Error: {}.".format(r.status_code))
    return r.json()