A command-line utility to determine your internet-facing public IP address
Project description
publicip
A command-line utility that reports your internet-facing public IP address. Queries multiple well-known free services with automatic fallback so you always get an answer even if a provider is down.
Installation
pip install publicip
Or with uv:
uv tool install publicip
Usage
publicip # print your public IP
publicip --verbose # include which provider responded
publicip --format json # JSON output
publicip --format json --verbose # JSON with provider field
publicip --provider ipify # force a specific provider
publicip --all # query all providers
Providers
| Name | Service |
|---|---|
ipify |
api.ipify.org |
icanhazip |
icanhazip.com |
identme |
4.ident.me |
seeip |
ipv4.seeip.org |
The default order is ipify → icanhazip → identme → seeip. The first successful response wins.
Examples
$ publicip
203.0.113.42
$ publicip --verbose
203.0.113.42 (via ipify)
$ publicip --format json --verbose
{"ip": "203.0.113.42", "provider": "ipify"}
$ publicip --all
203.0.113.42 (via ipify)
203.0.113.42 (via icanhazip)
203.0.113.42 (via ident.me)
203.0.113.42 (via seeip)
Limitations
Currently, publicip only returns your public IPv4 address. IPv6 is not supported. All configured providers are queried via their IPv4 endpoints.
IPv6 support is a planned future enhancement.
Contributing
See CONTRIBUTING.md.
Security
To report a vulnerability privately, see SECURITY.md.
License
MIT © Andre Van Klaveren
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file publicip_cli-0.1.2.tar.gz.
File metadata
- Download URL: publicip_cli-0.1.2.tar.gz
- Upload date:
- Size: 61.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12b342e27bee381ba11f6ab00c49f8c0b2f24952e976910440dfb11ebc721029
|
|
| MD5 |
2c66fcdf7679548c54f11884fe64d9e6
|
|
| BLAKE2b-256 |
4c3b2cd689cc413fced0e8227deb4027178656016664cfb37ff98de3bcd03aa4
|
Provenance
The following attestation bundles were made for publicip_cli-0.1.2.tar.gz:
Publisher:
publish.yml on opratr/publicip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
publicip_cli-0.1.2.tar.gz -
Subject digest:
12b342e27bee381ba11f6ab00c49f8c0b2f24952e976910440dfb11ebc721029 - Sigstore transparency entry: 1624971674
- Sigstore integration time:
-
Permalink:
opratr/publicip@1f325284f8abb58940f3b0cb62e0aee1c2b9ae25 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/opratr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1f325284f8abb58940f3b0cb62e0aee1c2b9ae25 -
Trigger Event:
release
-
Statement type:
File details
Details for the file publicip_cli-0.1.2-py3-none-any.whl.
File metadata
- Download URL: publicip_cli-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc9aa27d7ed21d14e56195c972f2a9c8689f9616931662525712e0ab8f15ce9e
|
|
| MD5 |
11492fae5fe92ecf971630559be4c38f
|
|
| BLAKE2b-256 |
fcfc5fba2122e4d0b4db039d9acbc9f0de7520c0f57a70a0a0c9f3abc0cbf0de
|
Provenance
The following attestation bundles were made for publicip_cli-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on opratr/publicip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
publicip_cli-0.1.2-py3-none-any.whl -
Subject digest:
bc9aa27d7ed21d14e56195c972f2a9c8689f9616931662525712e0ab8f15ce9e - Sigstore transparency entry: 1624971733
- Sigstore integration time:
-
Permalink:
opratr/publicip@1f325284f8abb58940f3b0cb62e0aee1c2b9ae25 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/opratr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1f325284f8abb58940f3b0cb62e0aee1c2b9ae25 -
Trigger Event:
release
-
Statement type: