Created
December 11, 2021 07:58
-
-
Save harendra21/abc018ff57280d837bb2f3a0014cfb28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get Ipaddress and Hostname of Website | |
# importing socket library | |
import socket | |
def get_hostname_IP(): | |
hostname = input("Please enter website address(URL):") | |
try: | |
print (f'Hostname: {hostname}') | |
print (f'IP: {socket.gethostbyname(hostname)}') | |
except socket.gaierror as error: | |
print (f'Invalid Hostname, error raised is {error}') | |
get_hostname_IP() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment