Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(8)  |  Call(8)  |  Derive(0)  |  Import(0)

src/m/a/MaxMind-DB-Reader-python-HEAD/examples/benchmark.py   MaxMind-DB-Reader-python(Download)
def lookup_ip_address():
    ip = socket.inet_ntoa(struct.pack('!L', random.getrandbits(32)))
    record = reader.get(str(ip))
 
 

src/g/e/geodude-HEAD/geodude.py   geodude(Download)
    def fetch_geo_data(ip):
        data = reader.get(ip)
        return {
            'country_code': data['country']['iso_code'].lower(),
            'country_name': data['country']['names']['en'],

src/m/a/MaxMind-DB-Reader-python-HEAD/tests/reader_test.py   MaxMind-DB-Reader-python(Download)
    def test_decoder(self):
        reader = Reader('tests/data/test-data/MaxMind-DB-test-decoder.mmdb')
        record = reader.get('::1.1.1.0')
 
        self.assertEqual(record['array'], [1, 2, 3])
                                    'You attempted to look up an IPv6 address '
                                    'in an IPv4-only database'):
            reader.get('2001::')
 
    def test_broken_database(self):
                                    "type or corrupt data\)"
                                    ):
            reader.get('2001:220::')
 
    def test_ip_validation(self):

src/m/a/maxminddb-0.3.3/tests/reader_test.py   maxminddb(Download)
    def test_decoder(self):
        reader = Reader('tests/data/test-data/MaxMind-DB-test-decoder.mmdb')
        record = reader.get('::1.1.1.0')
 
        self.assertEqual(record['array'], [1, 2, 3])
                                    'You attempted to look up an IPv6 address '
                                    'in an IPv4-only database'):
            reader.get('2001::')
 
    def test_broken_database(self):
                                    "type or corrupt data\)"
                                    ):
            reader.get('2001:220::')
 
    def test_ip_validation(self):