Hello one and all,
and of course I am new to Prefect so please forgive the following code snippet - I am attempting to connect to a webhook for notifications purposes in Teams, what I have is working, however, I also need the project name as well as the a link to a failed Flow's logs (e.g.
http://172.18.1.5:8080/default/flow-run/618e28e6-e0ac-44aa-85e3-ccf4f865c833?logs=). This is what I have so far:
import requests
import os
def vent(flow:str,state:str):
msg = "Flow {0} finished in fail state '{1}'".format(flow, state)
g = os.environ.get("TEAMS_NOTIFICATION")# webhook link to Outlook for Teams
<http://requests.post|requests.post>(g, json={"text": msg})
check = lambda flow,state:vent(flow.name,state.message)
.
.
.
with Flow(flow_name, schedule=None,on_failure=check) as flow:
Which is probably not optimal but I just found the API and I don't have the time to tuck in at the moment. Any help is greatly appreciated. Thanks.