I wrote a script with python to automate some things with JIRA and I used the module Requests:

The thing is, when there was not network connectivity this error raised:

So I had to add some error handling for that. Error handling is well explained here.

The first thing to do was to import the exception from the error:

Like this:

Then define a Rise statement with a try, except block. Here “Rise” will force the error (so I don’t need to unplug my cable):

Although it worked I fully tested removing the raise statement and unplugging the cable, everything worked as expected.