def connect(database_key): access_information = opsutils.load_access_information(look_at="home") if (database_key == "replica"): print("Connecting to database replica") return opsutils.DatabaseHandler( access_information["database_replica_ops"]) elif (database_key == "finops"): print("Connecting to database finops") return opsutils.DatabaseHandler( access_information["database_finops_ops"]) elif (database_key == "redshift"): print("Connecting to database redshift") return opsutils.DatabaseHandler( access_information["database_redshift_ops"])
def main(): pagarme_admin = opsutils.PagarmeAdmin() pagarme_admin.load_session_id() session_id = pagarme_admin.get_session_id() access_information = opsutils.load_access_information(look_at="home") database_replica = opsutils.DatabaseHandler( access_information["database_replica"]) slack = opsutils.Slack(access_information["slack_loro"]["token"]) # 3 tries to delete the building BAs for i in range(3): building_bas = fetch_building_bas(database_replica) if (len(building_bas) > 0): delete_building_bas(session_id, building_bas) time.sleep(5) else: slack.send_message("#risco", "D0 liberadas") break else: headers = ["id", "company_id", "recipient_id", "time"] table = [(row["id"], row["company_id"], row["recipient_id"], row["time"]) for row in building_bas] slack.send_message("@gabriel.salla", "```%s```" % tabulate(table, headers=headers))
"open": "green", "closed": "red", "merged": "purple", "declined": "blue" } repository_name = "pagarme-core" issue_number_list = [655, 599, 597, 488, 939] # strip colors if stdout is redirected init(strip=not sys.stdout.isatty()) text = "Issues" cprint(figlet_format(text, font='banner3'), 'green', 'on_blue', attrs=['bold']) access_info = opsutils.load_access_information(look_at="home") github_token = access_info["github"]["token"] access_info = opsutils.load_access_information(look_at="home") slack_token = access_info["slack"]["token"] Slack = opsutils.Slack(slack_token) channel_name = "ops-issues" ##################### # MAIN # ##################### print("Running...") g = Github(github_token)