# -*- coding: utf-8 -*-
import requests
 
def get_physical_location(ip):
    url = 'http://ip.taobao.com/service/getIpInfo.php?ip=' + ip
    r = requests.get(url)
    if r.json()['code']:
        print '您输入的ip地址有误,请检查后再试。'
    else:
        country = r.json()['data']['country']
        region = r.json()['data']['region']
        city = r.json()['data']['city']
        return country + region + city

 

相关文章:

  • 2021-09-01
  • 2022-02-09
  • 2021-07-31
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-11
  • 2022-12-23
  • 2021-07-17
  • 2021-12-22
  • 2021-11-10
  • 2021-08-10
  • 2021-10-27
相关资源
相似解决方案