import requests


def vt_lookup(hashValue, apiKey):
    """
    Perform API lookup on hash value and return json data results
    """
    print(f'VirusTotal report details for file hash: {hashValue}\n')
    url = f'https://www.virustotal.com/api/v3/files/{hashValue}'
    headers = {
        'x-apikey': apiKey,
        'Accept': 'application/json',
    }

    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()
        return response.json()
    except requests.exceptions.HTTPError as e:
        if "404" in str(e):
            print(
                '404 response returned likely meaning no file hash matches have been found.\n')
        else:
            print(f'API response: {e}')
            print(
                'For more information visit: https://developers.virustotal.com/reference/errors\n')
        exit(1)