As a CLI tool:
$ pip3 install whatsmyip
$ myip
240.0.0.0
As a library:
>>> from whatsmyip.ip import get_ip
>>> from whatsmyip.providers import GoogleDnsProvider # Or any other provider
>>> get_ip(GoogleDnsProvider)
'240.0.0.0'
- Google DNS
- httpbin.org
- Cloudflare
- DNS
- HTTP
The goal of this project is not to become the best tool to check your IP address. In that case I recommend you to use something more simple like:
curl https://httpbin.org/ip
I've developed this project to have something simple to experiment with when explorering new ideas or techniques.