|
@@ -33,15 +33,14 @@ class IPQuery:
|
|
|
res_data = eval(res.content.decode('utf-8'))
|
|
|
if res_data['ret'] == 200:
|
|
|
district = res_data['data']['district']
|
|
|
-
|
|
|
- # 城市数据不为空字符,拼上'市'字
|
|
|
city = res_data['data']['city']
|
|
|
- if city != '':
|
|
|
- city += '市'
|
|
|
-
|
|
|
region = res_data['data']['region']
|
|
|
country_id = res_data['data']['country_id']
|
|
|
|
|
|
+ # 国内城市数据不为空字符,拼上'市'字
|
|
|
+ if country_id == 'CN' and city != '':
|
|
|
+ city += '市'
|
|
|
+
|
|
|
# ip地址信息存表
|
|
|
IPAddr.objects.create(ip=ip, district=district, city=city, region=region, country_code=country_id)
|
|
|
|