How would you improve a simple Python script that monitors internet connection?

Posted by CountyThen6572@reddit | learnprogramming | View on Reddit | 3 comments

Hi,

I built a small Python script to monitor internet connection and detect outages.

It currently:

- checks connectivity (ping/requests)

- logs downtime

- has basic retry logic

I’m trying to improve it and make it more robust.

What would you suggest?

For example:

- better way to handle connection checks?

- logging improvements?

- structure or performance ideas?

I’d really appreciate any advice from more experienced devs.