Python Making Methods Modular and DRY
All the methods in InvokeRequest are basically the same. The only part that differs is the URL. Just pass that in instead of passing in the parts of the URL and constructing the URL in the function.

Before I show the function that I came up with though, I'll note that there's no reason InvokeRequest should be a class, and there's also no reason that self.URL and self.response in those methods should be instance attributes. I'm far from practiced in OOP, but making arbitrary bits of code into classes isn't helpful. If you were passing the self.server data into the constructor, then maybe there would be some justification. As it stands now though, I'm going to get rid of the class and instance attributes.

To start out with, here's the basic part that was repeated in all the methods:

def get_response(url):
    response = requests.get(url, auth=(username, PAT), verify=False)
    return response.json()


It now expects that the url will be passed in like I mentioned. You can ease making the URL though using a helper:

def build_url(*parts):
    return BASE_URL + "".join(parts)


If you haven't encountered var-args before, *parts just means that the function accepts as many arguments as you want, and bundles them into a tuple.

Now you can write:

json = get_response(build_url(project, "/_apis/git/repositories"))  # Was getRepositories
json = get_response(build_url(releaseID, "/_apis/git/releaseID"))  # Was getReleaseDefinitions
json = get_response(build_url(project, "/_apis/build/definitions/", str(ID)))  # Was getBuildDefinitionID


You could also put the call to build_url inside get_response and have *parts as the parameter to get_response:

def get_response(*parts):
    url = build_url(*parts)
    response = requests.get(url, auth=(username, PAT), verify=False)
    return response.json()

json = get_response(project, "/_apis/git/repositories")
json = get_response(releaseID, "/_apis/git/releaseID")
json = get_response(project, "/_apis/build/definitions/", str(ID))


Which you want to use depends on if get_response will always use a URL returned by build_url, or if it can differ.

You could wrap the calls to get_response in some functions too to avoid needing to manually put the URL together each time:

def get_build_definition_ID():
    return get_response(project, "/_apis/build/definitions/", str(ID))




Also note the naming convention I used. Python uses snake_case, not camelCase.