whatismyip
Fetch your public IP address from external sources with Python.
Install with pip install whatismyip
Example:
>>> import whatismyip
>>> whatismyip.amionline()
True
>>> whatismyip.whatismyip()
'69.89.31.226'
>>> whatismyip.whatismyipv4()
'69.89.31.226'
>>> whatismyip.whatismyipv6()
'2345:0425:2CA1:0000:0000:0567:5673:23b5'
>>> whatismyip.whatismylocalip() # Returns local IPs of all network cards.
('192.168.189.1', '192.168.220.1', '192.168.56.1', '192.168.1.201')
>>> whatismyip.whatismyhostname()
'GIBSON'
On average these ip-finding functions take about half a second to run. Your results may vary.
Because whatismyip relies on online services, you always want to update to the latest version. This module uses calendar versioning, such as version 2024.2.20 for the version released on February 20, 2024.
How Does whatismyip Work?
There are several public STUN (Session Traversal Utilities for NAT) servers (listed in the whatismyip.STUN_SERVERS variable, in order of response speed) that return your IP address (as it appears to them). There are also several public websites that you can view in your browser (listed in whatismyip.IP4_WEBSITES, whatismyip.IP6_WEBSITES, and whatismyip.IP_WEBSITES):
- https://api.ipify.org
- https://checkip.amazonaws.com/
- https://icanhazip.com
- https://ipinfo.io/ip
- https://ipecho.net/plain
- https://ifconfig.me/ip
- https://v4.ident.me
- https://v6.ident.me
- https://v4.tnedi.me
- https://v6.tnedi.me
- https://tnedi.me/
- https://curlmyip.net
- https://wtfismyip.com/text
The whatismyip module does not have any dependencies outside the Python standard library. It does not require Requests to be installed.
Support
If you find this project helpful and would like to support its development, consider donating to its creator on Patreon.
Metadata
Release files for WhatIsMyIP 2026.5.22
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| whatismyip-2026.5.22.tar.gz | 10.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| whatismyip-2026.5.22-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.7 kB
Release files / whatismyip-2026.5.22.tar.gz
| Download URL | whatismyip-2026.5.22.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e764fcc23afea4622f69992ac7015bed4e514773c7047ebd0afc1c421e79465
|
|
BLAKE2b-256 checksum How to use checksums |
3280a2885b9235029b8b5cfbe9457f8d365cd48d0f0b33307fbc5eb484813cbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Release files / whatismyip-2026.5.22-py3-none-any.whl
| Download URL | whatismyip-2026.5.22-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
955563cfe03264c8f2bc361f592123443bbec0a3c4d2f18ae37830f0dc50d126
|
|
BLAKE2b-256 checksum How to use checksums |
93e0835571ca502ddb4a0c02d55d16fca999454a4686aee5c6f55adb55f788bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Security for WhatIsMyIP 2026.5.22
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.