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.2.0.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for publicaddr-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64b8668b04dcc3bb1a19f60d470c3d9d79c5c9bfe25cba402cc6e12f3c2adfcc |
|
MD5 | c92be006cbdf0f5d6ba0f49d7708ccc6 |
|
BLAKE2b-256 | d0af41b7cbfc9f9af2031c01ecb0e329094377493b488199aedede07303c4aa5 |