def __init__(self, conf): self.conf = conf self.credentials = CredentialsConfig(self.conf.site.credentials) self.c = None self.issues_created = [] self.abort_on_error = True self.results_format = 'list' self.versions_cache = {}
def corp_api_call(endpoint, conf): credentials = CredentialsConfig(conf.site.credentials).corp url = conf.site.corp + "/api/" + endpoint headers = {'accept': 'application/json'} response = requests.get(url, auth=HTTPDigestAuth(credentials.username, credentials.password), headers=headers) return response.json()
def get_connection(conf): credentials = CredentialsConfig(conf.site.credentials).github if 'token' in credentials: gh = login(token=credentials.token) else: gh = login(credentials.username, credentials.password, two_factor_callback=collect_two_factor_token) return gh
def new_credentials_config(conf_path=None): if conf_path is None: for fn in [ os.path.expanduser("~/.giza-credentials.yaml"), os.path.expanduser("~/.mongodb-jira.yaml") ]: if os.path.isfile(fn): conf_path = fn break if conf_path is None and not (os.path.isfile(conf_path) or isinstance(conf_path, dict)): return None else: return CredentialsConfig(conf_path)
def new_credentials_config(conf_path=None): if conf_path is None: conf_path = os.path.expanduser("~/.mongodb-jira.yaml") return CredentialsConfig(conf_path)