This Python script provides information about an IP address using the ipinfo.io API. It displays details such as IP address, country, location, ISP, postal code, and coordinates.
-
requests: A library for making HTTP requests
- Install using:
pip install requests
- Install using:
-
pyfiglet: A library for creating custom text banners using ASCII art
- Install using:
pip install pyfiglet
- Install using:
-
Formatted String: The
api_url
variable is a formatted string used to construct the API URL with the target IP address.- Example:
api_url = f"https://ipinfo.io/{ip_address}/json"
- Example:
-
JSON Format: The script specifies that the information needed is in JSON (JavaScript Object Notation) format.
response = requests.get(api_url)
: The request is made to the API, and the response is stored in theresponse
variable.
-
Data Storage: The information from the response is stored in the
data
dictionary for easier accessibility.data = response.json()
-
Main Script Check: The block
if __name__ == "__main__":
is used to determine whether the Python script is being run as the main script.banner()
: Invokes thebanner
function to display a custom text banner.
-
Clone the repository:
git clone https://github.com/hardikkum444/IPINFO---Hardik-Kumawat.git cd IPINFO---Hardik-Kumawat
-
Install the required dependencies:
pip install requests pip install pyfiglet
-
Run the script:
python3 ipinfo.py
-
Follow the prompts to enter the target IP address.
- HARDIK - GitHub
Feel free to contribute, open issues, or provide feedback.