Skip to content
This repository was archived by the owner on Jun 1, 2022. It is now read-only.

Commit 342b4ff

Browse files
author
borisz
committed
Add new methods record_by_name_v6 and record_by_addr_v6 to support GeoIPCityv6 databases. ( Boris Zentner )
1 parent 65a30bc commit 342b4ff

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

ChangeLog

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
1.2.6 2011-06-06
2+
* Add new methods record_by_name_v6 and record_by_addr_v6 to support
3+
GeoIPCityv6 databases. ( Boris Zentner )
14
1.2.5 2011-05-10
25
* Remove Confidence and Accuracy Database it is unsued anyway. ( Boris
36
Zentner )

py_GeoIP.c

+32-2
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,36 @@ static PyObject * GeoIP_populate_dict(GeoIP* gi, GeoIPRecord *gir) {
337337
return retval;
338338
}
339339

340+
static PyObject * GeoIP_record_by_addr_v6_Py(PyObject *self, PyObject *args) {
341+
char * addr;
342+
GeoIPRecord * gir;
343+
GeoIP_GeoIPObject* GeoIP = (GeoIP_GeoIPObject*)self;
344+
if (!PyArg_ParseTuple(args, "s", &addr)) {
345+
return NULL;
346+
}
347+
gir = GeoIP_record_by_addr_v6(GeoIP->gi, addr);
348+
if (gir == NULL) {
349+
Py_INCREF(Py_None);
350+
return Py_None;
351+
}
352+
return GeoIP_populate_dict(GeoIP->gi, gir);
353+
}
354+
355+
static PyObject * GeoIP_record_by_name_v6_Py(PyObject *self, PyObject *args) {
356+
char * name;
357+
GeoIPRecord * gir;
358+
GeoIP_GeoIPObject* GeoIP = (GeoIP_GeoIPObject*)self;
359+
if (!PyArg_ParseTuple(args, "s", &name)) {
360+
return NULL;
361+
}
362+
gir = GeoIP_record_by_name_v6(GeoIP->gi, name);
363+
if (gir == NULL) {
364+
Py_INCREF(Py_None);
365+
return Py_None;
366+
}
367+
return GeoIP_populate_dict(GeoIP->gi, gir);
368+
}
369+
340370
static PyObject * GeoIP_record_by_addr_Py(PyObject *self, PyObject *args) {
341371
char * addr;
342372
GeoIPRecord * gir;
@@ -465,8 +495,6 @@ static PyObject * GeoIP_time_zone_by_country_and_region_Py(PyObject *self, PyObj
465495
return Py_BuildValue("s", GeoIP_time_zone_by_country_and_region(country_code, region));
466496
}
467497

468-
469-
470498
static PyMethodDef GeoIP_Object_methods[] = {
471499
{"country_code_by_name", GeoIP_country_code_by_name_Py, 1, "Lookup Country Code By Name"},
472500
{"country_name_by_name", GeoIP_country_name_by_name_Py, 1, "Lookup Country Name By Name"},
@@ -490,6 +518,8 @@ static PyMethodDef GeoIP_Object_methods[] = {
490518
{"teredo", GeoIP_teredo_Py, 1, "Returns true if teredo is enabled"},
491519
{"id_by_addr", GeoIP_id_by_addr_Py, 1, "Lookup Netspeed By IP Address"},
492520
{"id_by_name", GeoIP_id_by_name_Py, 1, "Lookup Netspeed By Name"},
521+
{"record_by_addr_v6", GeoIP_record_by_addr_v6_Py, 1, "Lookup City Region By IP Address"},
522+
{"record_by_name_v6", GeoIP_record_by_name_v6_Py, 1, "Lookup City Region By Name"},
493523
{NULL, NULL, 0, NULL}
494524
};
495525

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
include_dirs = ['/usr/local/include'])
88

99
setup (name = 'GeoIP-Python',
10-
version = '1.2.5',
10+
version = '1.2.6',
1111
description = 'This is a python wrapper to GeoIP',
1212
ext_modules = [module1])

0 commit comments

Comments
 (0)