From f5d1af5b2552ee58805beb54787da0363e674b98 Mon Sep 17 00:00:00 2001 From: area363 Date: Fri, 15 Mar 2024 13:45:16 +0900 Subject: [PATCH] send slack message only when slack token exists --- scripts/app/test_internal_chain.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/app/test_internal_chain.py b/scripts/app/test_internal_chain.py index 1947f87e8..c8b515e52 100644 --- a/scripts/app/test_internal_chain.py +++ b/scripts/app/test_internal_chain.py @@ -90,8 +90,8 @@ async def process_block(blocks): # Increment the offset for the next query offset += current_limit - # The URL you want to send the data to - url = f'https://planetariumhq.slack.com/services/hooks/slackbot?token={config.slack_token}&channel=%23{config.slack_channel}' - data = f"[9C-INFRA] Finished testing `{network}` network from `#{original_offset}` to `#{tip_index}`." - headers = {'Content-Type': 'text/plain'} - response = requests.post(url, data=data, headers=headers) + if hasattr(config, 'slack_token') and config.slack_token: + url = f'https://planetariumhq.slack.com/services/hooks/slackbot?token={config.slack_token}&channel=%23{config.slack_channel}' + data = f"[9C-INFRA] Finished testing `{network}` network from `#{original_offset}` to `#{tip_index}`." + headers = {'Content-Type': 'text/plain'} + response = requests.post(url, data=data, headers=headers)