INNER CODE UNIT · Python
send_to_teams
aws-samples/aws-health-aware · handler.py:312
def send_to_teams(message, webhookurl):
teams_message = message
req = Request(
webhookurl,
data=json.dumps(teams_message).encode("utf-8"),
headers={"content-type": "application/json"},
)
try:
response = urlopen(req)
response.read()
except HTTPError as e:
print("Request failed : ", e.code, e.reason)
except URLError as e:
print("Server connection failed: ", e.reason, e.reason)
def send_email(event_details, eventType, affected_accounts, affected_entities):
SENDER = os.environ["FROM_EMAIL"]