def __get_one_account_id(self, email_address): query = f"email:{email_address}" response = self.gerrit_api.query_account(query, 1) accounts = Parser.get_json_content(response) if len(accounts) == 0: print(f"warn: unable to obtain the account id of " f"\"{email_address}\"") print(vars(response)) return None return accounts[0]["_account_id"]
def __query_new_changes(self, query_age): query = (f"projects:{self.config.projects_prefix} " f"status:open -is:wip -age:{query_age}") response = self.gerrit_api.query_changes( query, self.config.query_limit, ["CURRENT_REVISION", "REVIEWER_UPDATES", "DETAILED_ACCOUNTS"]) if response.status_code >= 300: print("Error: Couldn't query new Gerrit changes") print(vars(query_new_gerrit_changes_response)) raise Error() new_changes = Parser.get_json_content(response) return new_changes
def __get_bot_account_id(self): account_info = Parser.parse(self.gerrit_api.get_account("self")) return account_info._account_id