How to determine the IP address of the server after connecting with urllib2?
问题 I am downloading data from a server using urllib2. But I need to determine the IP address of the server to which I am connected. import urllib2 STD_HEADERS = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9, */*;q=0.8', 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'Accept-Language': 'en-us,en;q=0.5', 'User-Agent': 'Mozilla/5.0 (X11; U; Linux x86_64;en-US;rv:1.9.2.12) Gecko/20101028 Firefox/3.6.12'} request = urllib2.Request(url, None, STD_HEADERS) data = urllib2