I would like to create a conditional function in python, which return something else if 502 Bad Gateway happens.
def getData(request):
url = "https://data.ontario.ca/dataset/1115d5fe-dd84-4c69-b5ed-05bf0c0a0ff9/resource/d1bfe1ad-
6575-4352-8302-09ca81f7ddfc/download/cases_by_status_and_phu.csv"
if not 502 Bad Gateway:
return pd.read_csv(url)
else:
return 'None'
502-Bad-Gateway
I would highly appreciate it if you could please help me to write that function.