def validate_input(self, validation_definition):
        """In this example we are using external validation to verify that the Github
        repository exists. If validate_input does not raise an Exception, the input
        is assumed to be valid. Otherwise it prints the exception as an error message
        when telling splunkd that the configuration is invalid.

        When using external validation, after splunkd calls the modular input with
        --scheme to get a scheme, it calls it again with --validate-arguments for
        each instance of the modular input in its configuration files, feeding XML
        on stdin to the modular input to do validation. It is called the same way
        whenever a modular input's configuration is edited.

        :param validation_definition: a ValidationDefinition object
        """
        # Get the values of the parameters, and construct a URL for the Github API
        owner = validation_definition.parameters["owner"]
        repo_name = validation_definition.parameters["repo_name"]
        repo_url = "https://api.github.com/repos/%s/%s" % (owner, repo_name)

        # Read the response from the Github API, then parse the JSON data into an object
        response = urllib2.urlopen(repo_url).read()
        jsondata = json.loads(response)

        # If there is only 1 field in the jsondata object,some kind or error occurred
        # with the Github API.
        # Typically, this will happen with an invalid repository.
        if len(jsondata) == 1:
            raise ValueError("The Github repository was not found.")

        # If the API response seems normal, validate the fork count
        # If there's something wrong with getting fork_count, raise a ValueError
        try:
            fork_count = int(jsondata["forks_count"])
        except __HOLE__ as ve:
            raise ValueError("Invalid fork count: %s", ve.message)
dataset/ETHPy150Open splunk/splunk-sdk-python/examples/github_forks/github_forks.py/MyScript.validate_input