Skip to main content

Getting your public IP v4 and v6

Project description

Intro

Testing Build Publish

License: MIT PyPI - Python Version

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


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)

Uploaded Source

Built Distribution

publicaddr-0.2.0-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

Supported by

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