I was able to resolve the issue. since you said that there is nothing wrong with python as such... and its a networking issue. I deleted the network adapter of my vm and then re-created it. now suddenly it began to work. funny!