I tried to make the PublicIP() function a bit robust, using a timeout of 5 seconds so it couldn’t hang up any calling programs, and performing a lot of error handling. For example, a 429 response from myexternalip.com means that the rate limit has been exceeded (30 requests per minute). As I like the service, I wanted to make sure this was maintained so I ensured an error was thrown if this was breached. Additionally I used the json format rather than the raw format which meant I had to do some parsing, but I think it lends the code a bit more stability.