Skip to main content

Get your own ip address

Project description

getownip - A python script to determine your ip address

Example:

import getownip
print("public IPv4: " + getownip.get(getownip.Public, getownip.IPv4))
print("local IPv6: " + getownip.get(getownip.Local, getownip.IPv6))

To retrieve a local ip address, a default route must exist. Otherwise, None is returned.

When retrieving a public ip address, a random one of a list of servers is accessed. Currently, the following list of servers is used:

service IPv4 IPv6
getmyip.dev yes yes
icanhazip.com yes yes
ident.me yes yes
ipaddress.com yes
ipify.org yes yes
ipinfo.io yes yes
ipy.ch yes
l2.io yes
meineipv6.de yes yes
my-ip.io yes yes
seeip.org yes yes
tnedi.me yes yes

If one of these services fails to answer, another one will be tried until every service has failed. In this case, the last occurred exception will be thrown.

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

getownip-0.0.5.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

getownip-0.0.5-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file getownip-0.0.5.tar.gz.

File metadata

  • Download URL: getownip-0.0.5.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for getownip-0.0.5.tar.gz
Algorithm Hash digest
SHA256 74e890a61b307ef8809aae5c4634954a0c57c3fd5a22142ee5fb981910361f53
MD5 da1e63196415f1713c3b0d78a0428b30
BLAKE2b-256 a7cbdbf89fff334f73916e82247a87937b2018f5e039a149d470baa08551aa22

See more details on using hashes here.

File details

Details for the file getownip-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: getownip-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for getownip-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ef4f590c439de4979d0245d1c6608a901bb00982100b8bf5656a6e27c229c3ec
MD5 806758d2db5fd3a6ac38e62673f8be51
BLAKE2b-256 d264533a2a87bf28294cf6e9085305f8ffa01498f708aacb5829df43944b991e

See more details on using hashes here.

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