A Python function to get your public IP address.
Project description
A Python function to get your public IP address.
Installation
pip install public-ip
Usage example
import public_ip as ip
ip.get()
Sample output:
212.51.139.31
How it works
The function queries in parallel six different websites...
- https://api.ipify.org
- https://checkip.amazonaws.com
- https://icanhazip.com
- https://ifconfig.co/ip
- https://ipecho.net/plain
- https://ipinfo.io/ip
... and returns the most common IP among the responses. In this manner (a) we don't depend on a single external service and (b) we can determine the IP correctly as long as a majority of these sites return the right value.
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 public-ip-0.12.tar.gz.
File metadata
- Download URL: public-ip-0.12.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7930b430b9ddb7aa03db597a9ec649369687181024c831f9b350b108da02c11
|
|
| MD5 |
3428a9db3b8b3c08884ce79ebcfe24f3
|
|
| BLAKE2b-256 |
036a002a5a4ac6e37d2c3040c686ff8fa659316889f840087d2a369db0ff294e
|
File details
Details for the file public_ip-0.12-py3-none-any.whl.
File metadata
- Download URL: public_ip-0.12-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e5fb6d504b11a8fa06af3648a22cb2a4438f6fc1460392aab72c5eb6e835e10
|
|
| MD5 |
77a5ffabc5b1f6232107df8e9060b41f
|
|
| BLAKE2b-256 |
c3fb2c86b3f47c9465310057e3135cec4ccf36dc68ec656b2b63dcaee3a9fa49
|