I'm creating delete request to webserver and trying to catch the exceptions like below:
try: response = req.delete(path, auth=HTTPBasicAuth(config.user(), config.password()), params=params, headers=headers, verify=True) except requests.HTTPError as he: raise SystemExit(he) except requests.ConnectionError as ce: raise SystemExit(ce) except requests.URLRequired as ue: raise SystemExit(ue) except requests.Timeout as te: raise SystemExit(te) except requests.RequestException as err: print('Undefined error: ', err) print(response.status_code) But delete is not processed and response.status_code prints 400, but error handling does not work. Any ideas why the error handling is not working there?