diff options
| author | kd <kdam0@localhost.localdomain> | 2020-07-02 18:54:55 +0000 |
|---|---|---|
| committer | kd <kdam0@localhost.localdomain> | 2020-07-02 18:54:55 +0000 |
| commit | b575daf430946167baf688e486503d69fe495c5a (patch) | |
| tree | de9a6b61b7ec145bdac619072e406b13d62cb421 /main.py | |
| parent | 474fbe0850ba5dc6a7aa8eb06c60d229af674dcb (diff) | |
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 30 |
1 files changed, 16 insertions, 14 deletions
@@ -13,7 +13,7 @@ from msgraph import MSGraphApi logging.basicConfig(level=logging.INFO) LIMIT_THROUGHPUT = False -if __name__ == '__main__': +if __name__ == "__main__": # run the tests first suite = unittest.TestLoader().loadTestsFromModule(test) @@ -24,7 +24,7 @@ if __name__ == '__main__': config = json.load(open(sys.argv[1])) - #msapi = MSGraphApi(config).getAuth() # "app flow" + # msapi = MSGraphApi(config).getAuth() # "app flow" msapi = MSGraphApi(config, flow="obo").getAuth() if msapi is not None: @@ -34,19 +34,21 @@ if __name__ == '__main__': teamId = msapi.getTeamByName(config["teamname"]) channelId = msapi.getChatByNameAndTeamId(teamId, config["channelname"]) - #graph_data = msapi.getUsers().json() - #graph_data = msapi.getChatByTeamAndId(teamId, channelId).json() - #graph_data = msapi.writeChatMessageByTeamAndId( + # graph_data = msapi.getUsers().json() + # graph_data = msapi.getChatByTeamAndId(teamId, channelId).json() + # graph_data = msapi.writeChatMessageByTeamAndId( # teamId=teamId, # channelId=channelId, # payload={ "body" : { "content" : "hello world" } } - #).json() + # ).json() - #print("Graph API call result: ") - #print(json.dumps(graph_data, indent=2)) - #sys.exit(0) + # print("Graph API call result: ") + # print(json.dumps(graph_data, indent=2)) + # sys.exit(0) - sp = SlackParser("resources/channels/devops", "resources/users.json", ["text", "ts", "name"]).buildUsersLibrary() + sp = SlackParser( + "resources/channels/devops", "resources/users.json", ["text", "ts", "name"] + ).buildUsersLibrary() if sp.usersLib is {}: logging.error("Failed to read users. Shutting down with code 1.") sys.exit(1) @@ -62,9 +64,7 @@ if __name__ == '__main__': if reduced_message is not None: teams_mssg = msapi.buildTeamsMessage(reduced_message) graph_data = msapi.writeChatMessageByTeamAndId( - teamId=teamId, - channelId=channelId, - payload=teams_mssg + teamId=teamId, channelId=channelId, payload=teams_mssg ) if graph_data.status_code != 201: logging.error("failed to write to Teams") @@ -82,5 +82,7 @@ if __name__ == '__main__': time.sleep(1) else: - logging.error("Failed to Authenticate with Ms Graph. Shutting down with code 1.") + logging.error( + "Failed to Authenticate with Ms Graph. Shutting down with code 1." + ) sys.exit(1) |
