def test_dnslookup(self): self.assertEqual(dnslookup('http://ziade.org/'), 'http://88.191.140.69/') self.assertEqual(dnslookup('http://*****:*****@ziade.org:80/path'), 'http://*****:*****@88.191.140.69:80/path')
def test_dnslookup(self): ZIADE_DOT_ORG = "195.154.97.69" self.assertEqual(dnslookup('http://ziade.org/'), 'http://%s/' % (ZIADE_DOT_ORG,)) self.assertEqual(dnslookup('http://*****:*****@ziade.org:80/path'), 'http://*****:*****@%s:80/path' % (ZIADE_DOT_ORG,))
def test_dnslookup(self): ZIADE_DOT_ORG = "195.154.97.69" self.assertEqual(dnslookup('http://ziade.org/'), 'http://%s/' % (ZIADE_DOT_ORG, )) self.assertEqual(dnslookup('http://*****:*****@ziade.org:80/path'), 'http://*****:*****@%s:80/path' % (ZIADE_DOT_ORG, ))
def test_dnslookup(self): # TODO: This priodically breaks when Tarek gets a new IP # for his server, we should use something more stable... ZIADE_DOT_ORG = "163.172.47.3" self.assertEqual(dnslookup('http://ziade.org/'), 'http://%s/' % (ZIADE_DOT_ORG,)) self.assertEqual(dnslookup('http://*****:*****@ziade.org:80/path'), 'http://*****:*****@%s:80/path' % (ZIADE_DOT_ORG,))
def test_dnslookup(self): # TODO: This priodically breaks when Tarek gets a new IP # for his server, we should use something more stable... ZIADE_DOT_ORG = "163.172.47.3" self.assertEqual(dnslookup('http://ziade.org/'), 'http://%s/' % (ZIADE_DOT_ORG, )) self.assertEqual(dnslookup('http://*****:*****@ziade.org:80/path'), 'http://*****:*****@%s:80/path' % (ZIADE_DOT_ORG, ))
def _dnslookup(self, proxy): # does a DNS lookup with gethostbyname and cache it in # memory for one hour. current, age = self._resolved if current is None or age + 3600 < time.time(): current = dnslookup(proxy) self._resolved = current, time.time() return current