for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM):
    af, socktype, proto, canonname, sa = res
self.sock = socket.socket(af, socktype, proto)
try:
    self.sock.connect(sa)
except socket.error as msg:
    continue
break
Force python mechanize/urllib2 to only use A requests?