from urllib.request import urlopen
import json
def get_json_data(func):
    '''
    Get the data returned from a url generated by function
    '''
    def endpoint_response(*args, **kwargs):
        print(*args)
        print(**kwargs)
        print(func(*args, **kwargs))
        response = urlopen(func(*args, **kwargs))
        data = response.read().decode("utf-8")
        return json.loads(data)
    
    return endpoint_response
