We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c0f26e commit d28c5ffCopy full SHA for d28c5ff
Domain url.py
@@ -0,0 +1,19 @@
1
+import socket
2
+
3
+def get_domain_ip():
4
+ """Get the IP address of a given domain."""
5
+ try:
6
+ url_name = input('Enter the Domain URL(e,g google.com): ').strip()
7
+ if not url_name:
8
+ print("Error: Domain URL cannot be empty.")
9
+ return
10
11
+ ip = socket.gethostbyname(url_name)
12
+ print(f"The IP address of {url_name} is: {ip}")
13
+ except socket.gaierror:
14
+ print("Error: Unable to resolve the domain. Please check the URL.")
15
+ except Exception as e:
16
+ print(f"An unexpected error occurred: {e}")
17
18
+if __name__ == "__main__":
19
+ get_domain_ip()
0 commit comments