From ec88faa437d6e995927c50372dfde540bd301653 Mon Sep 17 00:00:00 2001 From: "A.M. Rowsell" Date: Wed, 5 Feb 2025 15:30:34 -0500 Subject: [PATCH] Changed HTTP status code checking to catch success codes other than 200 --- discorss.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/discorss.py b/discorss.py index 46224b3..7e49771 100755 --- a/discorss.py +++ b/discorss.py @@ -26,6 +26,7 @@ log_file_name = r"/app.log" # Yes, I know you "can't parse HTML with regex", but # just watch me. html_filter = re.compile(r"\<\/?([A-Za-z \"\=])*\>") +success_codes = ['200', '201', '202', '203', '204', '205', '206'] def get_description(feed): @@ -97,7 +98,7 @@ def main(): r = requests.post( hook["webhook"], data=webhook_string, headers=custom_header ) - if r.status_code != "200": + if r.status_code not in success_codes: print( "Error {} while trying to post {}".format( r.status_code, hook["webhook"]