Esempio n. 1
0
    def test_get_http_json(self):
        from ipwhois.rdap import RIR_RDAP
        result = Net('74.125.225.229')
        try:
            self.assertIsInstance(result.get_http_json(
                RIR_RDAP['arin']['ip_url'].format('74.125.225.229')), dict)
        except HTTPLookupError:
            pass
        except AssertionError as e:
            raise e
        except Exception as e:
            self.fail('Unexpected exception raised: {0}'.format(e))

        self.assertRaises(HTTPLookupError, result.get_http_json, **dict(
            url='http://255.255.255.255', retry_count=1))

        result = Net(address='74.125.225.229', timeout=0)
        url = RIR_RDAP['arin']['ip_url'].format('74.125.225.229')
        self.assertRaises(HTTPLookupError, result.get_http_json, **dict(
            url=url, retry_count=0))
Esempio n. 2
0
    def test_get_http_json(self):
        from ipwhois.rdap import RIR_RDAP
        result = Net('74.125.225.229')
        try:
            self.assertIsInstance(result.get_http_json(
                RIR_RDAP['arin']['ip_url'].format('74.125.225.229')), dict)
        except HTTPLookupError:
            pass
        except AssertionError as e:
            raise e
        except Exception as e:
            self.fail('Unexpected exception raised: {0}'.format(e))

        self.assertRaises(HTTPLookupError, result.get_http_json, **dict(
            url='http://255.255.255.255', retry_count=1))

        result = Net(address='74.125.225.229', timeout=0)
        url = RIR_RDAP['arin']['ip_url'].format('74.125.225.229')
        self.assertRaises(HTTPLookupError, result.get_http_json, **dict(
            url=url, retry_count=0))