Skip to main content

A command-line utility to determine your internet-facing public IP address

Project description

publicip

CI PyPI version Python versions License: MIT

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

publicip_cli-0.1.2.tar.gz (61.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

publicip_cli-0.1.2-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

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

Hashes for publicip_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 12b342e27bee381ba11f6ab00c49f8c0b2f24952e976910440dfb11ebc721029
MD5 2c66fcdf7679548c54f11884fe64d9e6
BLAKE2b-256 4c3b2cd689cc413fced0e8227deb4027178656016664cfb37ff98de3bcd03aa4

See more details on using hashes here.

Provenance

The following attestation bundles were made for publicip_cli-0.1.2.tar.gz:

Publisher: publish.yml on opratr/publicip

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for publicip_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bc9aa27d7ed21d14e56195c972f2a9c8689f9616931662525712e0ab8f15ce9e
MD5 11492fae5fe92ecf971630559be4c38f
BLAKE2b-256 fcfc5fba2122e4d0b4db039d9acbc9f0de7520c0f57a70a0a0c9f3abc0cbf0de

See more details on using hashes here.

Provenance

The following attestation bundles were made for publicip_cli-0.1.2-py3-none-any.whl:

Publisher: publish.yml on opratr/publicip

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page