Skip to main content

Retrieve local, global, external ipaddress.

Project description

gle_ip_info

glip is a module for retrieve ip address like local-ip, global-ip, external-ip as string.

Installation

Run the following to install:

'''python pip install gle_ip_info '''

Usage

''' from gle_ip_info import IP

Ip = IP() # Initialize the IP class

os = Ip.Os # To get your os info.

dev = Ip.devices # Gives connected devices as list.

local_ip = Ip.get_local_ip() # TO get your local ipaddress.

global_ip = Ip.get_global_ip() # To get your global ipaddress.

external_ip = Ip.get_external_ip() # To get external(of connected device) ipaddress, returns the ip address of 1st device '''

How it works

It use's --> ''' --> os module, --> requests module, --> platform module, --> upnpclient module.

***Local_IP is collected from the cmd(in Windows) or Bash-Terminal(in Linux) using 'ipconfig'/ 'hostname -I' command.So there is no need to get the hostname like socket module does and the accuracy of the output is 100% in Linux Os.

***Global_IP is collected by sending request to 'https://checkip.amazonaws.com' or 'https://www.wikipedia.org' using python requests module.So to get the global_ip a stable net connection is needed.

***External_IP of any router or alike devices can be collected using upnpclient module. It takes a little more time to get the external_ipaddress Compare to other two functions.Though it don't require stable Internet connection but requires a stable connection between the devices. '''

License

MIT License

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

LLOOL-0.1.1.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

LLOOL-0.1.1-py3-none-any.whl (3.1 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