예제 #1
0
def getYmlContent(environment):
    try:
        git = Github().get_user(user).get_repo(repo)
        content = git.get_file_contents(
            environment + "-config.yml").content.decode(
                git.get_contents(environment + "-config.yml").encoding)
        return content
    except:
        return "File not found!"
예제 #2
0
def file_content(filename):
    result = ""
    repo = ""
    try:
        repo = Github().get_user(url_split_list[1]).get_repo(url_split_list[2])
        result = repo.get_file_contents(filename).decoded_content
    except RateLimitExceededException:
        result = "Github API rate limit exceeded!!. Try Again"
    except UnknownObjectException:
        if type(repo) is not repository_class:
            result = "The run time URL didn't point to a valid github repository. Please provide a valid URL."
        elif ".json" in filename:
            result = "This JSON file is not available."
        elif ".yml" in filename:
            result = "This YML file is not available."
        else:
            result = "This is not a valid configuration file."
    finally:
        return result
예제 #3
0
def hello(variable):
    git = Github().get_user(user).get_repo(repo)
    stream = git.get_file_contents(variable).content.decode(
        git.get_contents(variable).encoding)
    #	print "stream %r" % stream
    return stream