Skip to content

Files

Latest commit

 

History

History

Get IP address and Hostname of Website

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Get IP address and Hostname of Website

This Python script retrieves the IP address and hostname of a given website URL using the socket library.

🗒️ Description

The script prompts the user to enter a website address (URL). It then attempts to fetch and display the corresponding hostname and IP address using the socket.gethostbyname() function. If the hostname is invalid or cannot be resolved, it catches and prints a socket.gaierror.

Required Modules

No additional modules are required beyond the standard Python library.

How to Install Required Modules

No installation of additional modules is needed

▶️ How to Run the Script

  1. Clone the Repository:
    git clone https://github.com/ShravanDalavi/Simple-Python-Mini-Projects.git
    
  2. Navigate to Directory:
           cd Simple-Python-Mini-Projects/Get\ IP\ address\ and\ Hostname\ of\ Website
  3. Run the Script:
        python get_ip_hostname.py
  • Enter a website URL to retrieve its IP address and hostname.