PyImgur
PyImgur copied to clipboard
Do not print anything on error raise an exception instead
Change this code this code to raise an exception instead of printing to stdout
if not resp.ok:
try:
error_msg = "Imgur ERROR message: {}".format(content['error'])
print(error_msg)
print("-" * len(error_msg))
except Exception:
pass
resp.raise_for_status()
eg:
if not resp.ok:
try:
raise ImgurException("Imgur ERROR message: {}".format(content['error']))
except Exception:
resp.raise_for_status()