from __future__ import print_function
import time
import authorizenet_rest
from authorizenet_rest.rest import ApiException

from authorizenet_rest.apis.webhooks_api import WebhooksApi
from pprint import pprint
import warnings
import os
import sys
# QA modification
import csv
# QA modification
# import imp
# constants = imp.load_source('modulename', 'constants.py')
# warnings.filterwarnings("ignore",category=DeprecationWarning)
import base64
import urllib3

ExternalConfig = imp.load_source('modulename', '.\ExternalConfiguration.py')

def delete_webhook():
    ExternalConfig.setConfig();
    apiclient = ExternalConfig.configureApiClient();
    authorization = ExternalConfig.getAuthorization()
    api_instance = authorizenet_rest.apis.webhooks_api.WebhooksApi(apiclient)
    webhookid = "dsgfjk4-dfsfd34-sdfsdfg4";

    try:
        api_response = api_instance.delete_webhook(webhookid, authorization=authorization)
        pprint(api_response[1])

    except ApiException as e:
        print("Connection exception:")
        print("Exception when calling WebhooksAPI->UpdateWebhook: %s\n" % e)




if (os.path.basename(__file__) == os.path.basename(sys.argv[0])):
    delete_webhook()