betterlib

A useful collection of various tools and libraries for anyone to use in their projects.


Project maintained by HENRYMARTIN5 Hosted on GitHub Pages — Theme by mattgraham

IP

This module contains the ipAdress class, a class that represents an IP address and its various properties.

Disclaimer

By using this module, you agree to the terms of service of the ip-api API.

Usage

To use the ipAddress class, import it and create a new ipAddress object. By default, if no IP address is passed, it will fetch and use your public IP.

from betterlib import ip

myip = ip.ipAddress()

Then, you can use the myip object to get various properties of the IP address.

print(myip.address) # Your public IP
print(myip.continent) # e.g. "North America"
print(myip.country) # e.g. "United States"
print(myip.reigonName) # e.g. "California"

To see a full list of supported attributes, check the section below.

Methods

Constructor

Attributes