def fullip(): headers = request.headers.environ ip = headers.get('REMOTE_ADDR', '') port = headers.get('REMOTE_PORT', '') url = 'http://api.map.baidu.com/location/ip?' + 'ak=%s&' % C.BAIDU_AK + '&ip=%s&coor=bd09ll' % (str(ip)) res = curl.openurl(url) res = ujson.loads(res) addr = '' if res and res['status'] == 0: addr = res['content']['address'] return success_response({'ip' : ip, 'port' : port, 'addr':addr})
def ip(): headers = request.headers.environ ip = headers.get('REMOTE_ADDR', '') port = headers.get('REMOTE_PORT', '') return success_response({'ip' : ip, 'port' : port})