mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 01:23:55 +08:00
@@ -67,11 +67,13 @@ def is_private_ip(ip_addr):
|
|||||||
|
|
||||||
def get_ip_info(ip_addr):
|
def get_ip_info(ip_addr):
|
||||||
try:
|
try:
|
||||||
url = "https://whois.pconline.com.cn/ipJson.jsp?json=true"
|
url = f"https://whois.pconline.com.cn/ipJson.jsp?json=true&ip={ip_addr}"
|
||||||
resp = requests.get(url).json()
|
resp = requests.get(url).json()
|
||||||
|
|
||||||
ip_info = {
|
ip_info = {
|
||||||
"city": resp.get("city")
|
"city": resp.get("city"),
|
||||||
|
"region": resp.get("region"),
|
||||||
|
"addr": resp.get("addr")
|
||||||
}
|
}
|
||||||
return ip_info
|
return ip_info
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user