Commit 6eeb4e8a by William Tisäter

Merge branch 'master' of https://github.com/likema/pygeoip

Conflicts:
	pygeoip/__init__.py
parents 14075edc af04f7ff
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -44,6 +44,7 @@ except ImportError:
import pygeoip.const
from pygeoip.util import ip2long
from pygeoip.timezone import time_zone_by_country_and_region
from pygeoip.regionname import region_name_by_country_and_region_code
MMAP_CACHE = const.MMAP_CACHE
......@@ -346,7 +347,8 @@ class GeoIP(GeoIPBase):
char = ord(record_buf[record_buf_pos+str_length])
if str_length > 0:
record['region_name'] = record_buf[record_buf_pos:record_buf_pos+str_length]
record['region'] = record_buf[record_buf_pos:record_buf_pos+str_length]
record['region_name'] = region_name_by_country_and_region_code(record['country_code'], record['region']) if 'country_code' in record else ''
record_buf_pos += str_length + 1
str_length = 0
......@@ -416,7 +418,7 @@ class GeoIP(GeoIPBase):
if 'country_code' in record:
record['time_zone'] = time_zone_by_country_and_region(
record['country_code'], record.get('region_name')) or ''
record['country_code'], record.get('region')) or ''
else:
record['time_zone'] = ''
......@@ -542,7 +544,7 @@ class GeoIP(GeoIPBase):
@type addr: str
@return: dict with country_code, country_code3, country_name,
region, city, postal_code, latitude, longitude,
dma_code, metro_code, area_code, region_name, time_zone
dma_code, metro_code, area_code, region, region_name, time_zone
@rtype: dict
"""
try:
......@@ -567,7 +569,7 @@ class GeoIP(GeoIPBase):
@type hostname: str
@return: dict with country_code, country_code3, country_name,
region, city, postal_code, latitude, longitude,
dma_code, metro_code, area_code, region_name, time_zone
dma_code, metro_code, area_code, region, region_name, time_zone
@rtype: dict
"""
addr = socket.gethostbyname(hostname)
......@@ -582,7 +584,7 @@ class GeoIP(GeoIPBase):
@param addr: IP address
@type addr: str
@return: dict containing country_code, region,
and region_name
region and region_name
@rtype: dict
"""
try:
......@@ -608,7 +610,7 @@ class GeoIP(GeoIPBase):
@param hostname: host name
@type hostname: str
@return: dict containing country_code, region,
and region_name
region and region_name
@rtype: dict
"""
addr = socket.gethostbyname(hostname)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment