Python Package - whatismyip
Posted by Al Sweigart in misc
Back in August 2020, I created a Python package whatismyip that can tell your Python script your public IP address using free, no-registration online services. This blog post covers the package after a recent update. The source code is available in a git repo. and you can download it with pip or other tools from PyPI. If you are interested in this package, I also have a whereismyip Python package that does geolocation based on IP address. To find out your IP address, run import whatismyip and call whatismyip.whatismyip() to return a string of the IPv4 or IPv6 address. There are additional functions for more specific requests. You can also run python -m whatismyip.