-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import logging | ||
import os | ||
|
||
import requests | ||
|
||
from counterpartycore.lib import config | ||
|
||
logger = logging.getLogger(config.LOGGER_NAME) | ||
|
||
|
||
def trigger_webhook(): | ||
webhook_url = os.environ.get("SLACK_HOOK") | ||
if not webhook_url: | ||
return False | ||
try: | ||
response = requests.get(webhook_url, timeout=10) | ||
response.raise_for_status() | ||
logging.info("Message sent to slack") | ||
return True | ||
except requests.exceptions.RequestException as e: | ||
logging.error(f"Error sending message to slack: {e}") | ||
Check warning Code scanning / pylint Use lazy % formatting in logging functions. Warning
Use lazy % formatting in logging functions.
|
||
return False | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters