def clef_error_check(func_to_decorate):
    """Return JSON decoded response from API call. Handle errors when bad response encountered."""
    def wrapper(*args, **kwargs):
        try:
            response = func_to_decorate(*args, **kwargs)
        except requests.exceptions.RequestException:
            raise ConnectionError(
                'Clef encountered a network connectivity problem. Are you sure you are connected to the Internet?'
            )
        else:
            raise_right_error(response)
        return response.json() # decode json
    return wrapper
def clef_error_check ( func_to_decorate ) : def wrapper ( * args , ** kwargs ) : try : response = func_to_decorate ( * args , ** kwargs ) except requests . exceptions . RequestException : raise ConnectionError ( 'Clef encountered a network connectivity problem. Are you sure you are connected to the Internet?' ) else : raise_right_error ( response ) return response . json ( ) return wrapper
Return JSON decoded response from API call. Handle errors when bad response encountered.