import socket hostname = input("Enter Hostname : ") hostname=hostname.strip() if len(hostname) < 1 : print('hostname cannot be empty') hostname='psglx73' portnum = input("Enter Port Number : ") portnum=portnum.strip() try : if len(portnum) < 1 : portnum='24670' i_portnum=int(portnum) except: print("invalid port number") portnum=string(24670) mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mysock.connect((hostname, i_portnum)) URL = 'GET http://'+hostname+':'+portnum+'/coreservices/DomainService HTTP/1.1\r\n\r\n' print('before invoking'+ URL) URL = URL.encode() print('after encode') print(URL) mysock.send(URL) # mysock.send(URL.encode()) while True: data = mysock.recv(512) if len(data) < 1: break print(data.decode(),end='') mysock.close()