File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ * Export the country list, country code -> country name mapping, and country->continent
2
+ mapping ( Ignacio Vazquez-Abrams )
1
3
* Changed license to LGPL from GPL
2
4
3
5
1.2.1 2005-06-28
Original file line number Diff line number Diff line change @@ -306,6 +306,28 @@ initGeoIP(void)
306
306
m = Py_InitModule ("GeoIP" , GeoIP_Class_methods );
307
307
d = PyModule_GetDict (m );
308
308
309
+ int total_ccodes = 251 ;
310
+
311
+ PyObject * ccode = PyTuple_New (total_ccodes );
312
+ PyObject * cname = PyDict_New ();
313
+ PyObject * ccont = PyDict_New ();
314
+ PyObject * s ;
315
+
316
+ int i = 0 ;
317
+ for (; i < total_ccodes ; i ++ )
318
+ {
319
+ s = PyString_FromString (GeoIP_country_code [i ]);
320
+ PyTuple_SET_ITEM (ccode , i , s );
321
+ Py_INCREF (s );
322
+ PyDict_SetItem (cname , s , PyString_FromString (GeoIP_country_name [i ]));
323
+ Py_INCREF (s );
324
+ PyDict_SetItem (ccont , s , PyString_FromString (GeoIP_country_continent [i ]));
325
+ };
326
+
327
+ PyDict_SetItemString (d , "country_codes" , ccode );
328
+ PyDict_SetItemString (d , "country_names" , cname );
329
+ PyDict_SetItemString (d , "country_continents" , ccont );
330
+
309
331
tmp = PyInt_FromLong (0 );
310
332
PyDict_SetItemString (d , "GEOIP_STANDARD" , tmp );
311
333
Py_DECREF (tmp );
You can’t perform that action at this time.
0 commit comments