from typing import Optional
from typing import Dict
import requests


def _query_cryptocompare(url: str, errorCheck: bool = True) -> Optional[Dict]:
    """
    Query the url and return the result or None on failure.
    
    :param url: the url
    :param errorCheck: run extra error checks (default: True)
    :returns: respones, or nothing if errorCheck=True
    """
    try:
        response = requests.get(url).json()
    except Exception as e:
        print('Error getting coin information. %s' % str(e))
        return None
    if errorCheck and (response.get('Response') == 'Error'):
        print('[ERROR] %s' % response.get('Message'))
        return None
    return response