|
@@ -27,4 +27,25 @@ docker run -d -p 80:5000 --restart=always --name ip hongwenjun/ip
|
|
|
|
|
|
[Pytyhon 使用百度地图API 进行 IP普通定位和地图显示](https://www.262235.xyz/index.php/archives/375/)
|
|
|
|
|
|
-演示网址: https://www.262235.xyz/ip/maps/
|
|
|
+演示网址: https://www.262235.xyz/ip/maps/
|
|
|
+
|
|
|
+### GPS定位百度的太拉,推荐购买: 免费试用500次, 1元能使用1万次 IP定位 API 接口
|
|
|
+- https://market.aliyun.com/products/57002002/cmapi00035184.html
|
|
|
+- `app.py` 中请更换你自己的 API
|
|
|
+```
|
|
|
+def ip2gdgps(ip):
|
|
|
+ url = 'http://ips.market.alicloudapi.com/iplocaltion?ip=' + ip
|
|
|
+ headers = {"Authorization":"APPCODE <<<IP定位APPCODE>>>" ,"Content-Type":"application/json; charset=utf-8" }
|
|
|
+ try:
|
|
|
+ r = requests.get(url=url , headers=headers)
|
|
|
+ data = r.json()
|
|
|
+ except :
|
|
|
+ return
|
|
|
+ # print(data)
|
|
|
+ if data['code'] != 100:
|
|
|
+ return (116.39564504, 39.92998578 , data['code']) # 查不到返回 北京 x,y
|
|
|
+ elif data['message'] == "success":
|
|
|
+ x = data['result']['lng']
|
|
|
+ y = data['result']['lat']
|
|
|
+ return (x, y, data['code'], data)
|
|
|
+```
|