#!usr/bin/env python
# -*- coding: utf-8 -*-
"""

"""

import json
from urllib.request import urlopen

def get_country(ip_address):
    '''Get ip_address!
    '''
    response = urlopen("http://freegeoip.net/json/"+ ip_address).read().decode("utf-8")
    response_json = json.loads(response)
    return response_json

IP_1 = "222.35.76.57"
IP_2 = "111.201.37.159"
IP_3 = "121.97.110.145"
IP_4 = "60.205.112.186"
print(get_country(IP_4))
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐