I believe RequestException is the base class exception so if you want to keep it specific then it might be better to put this one last https://stackoverflow.com/a/47007419
I've added some snippets below which could work to shorten the code a little but I haven't got a lot of experience with exepction handling so not sure if they would be considered bad practise or not:
except (requests.ConnectionError, requests.HTTPError, requests.ReadTimeout, requests.Timeout, requests.ConnectTimeout, requests.RequestException) as e :
print(f"{type(e).__name__}: {src}")
return None, False, None
or
except Exception as e:
print(f"{type(e).__name__}: {src}")
return None, False, None
Suggestion:
I believe RequestException is the base class exception so if you want to keep it specific then it might be better to put this one last https://stackoverflow.com/a/47007419
I've added some snippets below which could work to shorten the code a little but I haven't got a lot of experience with exepction handling so not sure if they would be considered bad practise or not:
or
_Originally posted by @Morsey187 in https://github.com/torchbox/wagtail-wordpress-import/pull/125#discussion_r774991305_