Opsgenie CheckMK integration is not working

@robin.gierse I have opened a thread here. When I run the script in the server with dummy data it is working fine.While putting the script under /omd/sites/xxxxxx/local/share/check_mk/notifications/ it is not working and throws the error

#!/usr/bin/env python3
# OpsGenie_integration

import json
import os
import requests

context= dict([(var[7:], value)
            for (var, value) in os.environ.items()
            if var.startswith("NOTIFY_")])

if "PARAMETER_1" in context:
    opsgenie_api_url = context["PARAMETER_1"]

    if "PARAMETER_1" in context.keys():
        del context["PARAMETER_1"]
    if "PARAMETERS" in context.keys():
        del context["PARAMETERS"]
else:
    print( "No API Key Specified.")
print("requesting")

newheader={"Content-Type": "application/json"}
response = requests.post(opsgenie_api_url, data=json.dumps(context), headers=newheader)
print(response.status_code)