Getting your public IP v4 and v6
Project description
Intro
Simple python module for getting your public IP V4 and V6 from several providers in random mode.
Supported providers:
- Google (DNS)
- Cloudflare (DNS)
- OpenDNS (DNS)
- Akamai (HTTP)
Installation
This module can be installed from pypi website
pip install publicaddr
Basic Usage
import publicaddr
publicaddr.getall()
{'ip4': 'x.x.x.x', 'ip6': 'x:x:x:x:x:x:x:x', 'provider': 'Google'}
Get IPv4 only
import publicaddr
publicaddr.get(ipversion=4)
{'ip': 'x.x.x.x', 'provider': 'Akamai'}
Select a specifc provider
Example to use the provider Akamai instead of random one.
import publicaddr
from publicaddr import PROVIDER_GOOGLE, PROVIDER_OPENDNS, PROVIDER_CLOUDFLARE, PROVIDER_AKAMAI
publicaddr.getall(PROVIDER_AKAMAI)
{'ip4': 'x.x.x.x', 'ip6': 'x:x:x:x:x:x:x:x', 'provider': 'Google'}
For developpers
Run test units
python3 -m unittest -v discover tests/
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
publicaddr-0.3.0.tar.gz
(4.7 kB
view hashes)
Built Distribution
Close
Hashes for publicaddr-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cd1faa40b4c4b54a794bf4b78f69294769509ac1fe8a6f00b2fdaf351f3e5a4 |
|
MD5 | f44f68b09ee507046b586f9d8e202620 |
|
BLAKE2b-256 | 27e92d098bcdd52a41fa3abca51cc7c93ac8ad8e4dcc93f7b5edae4c576677a6 |