用python进行实际地址经纬度提取

实际地址经纬度提取

请求接口:

https://apis.map.qq.com/ws/place/v1/suggestion/

所需参数:

参数名称 是否必须 参数类型 说明
keyword String 位置
region String 城市
key String 默认 K76BZ-W3O2Q-RFL5S-GXOPR-3ARIT-6KFE5
output String 默认 jsonp
callback String jQuery191023148659560008777_13位的时间戳
_ imestamp 13位的时间戳

栗子:

url = "https://apis.map.qq.com/ws/place/v1/suggestion/"
headers= {
    "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36",
    "Referer": "https://lbs.qq.com/tool/getpoint/getpoint.html"
}
param = {
    "keyword":"双井地铁站",
    "region": "",
    "key":"K76BZ-W3O2Q-RFL5S-GXOPR-3ARIT-6KFE5",
    "output":"jsonp",
    "callback":"jQuery191023148659560008777_1554977748452",
    "_":"1554977748452"
}
response = requests.get(url,params=param,headers=headers)
print(response.text)

返回结果

jQuery191023148659560008777_1554977748452&&jQuery191023148659560008777_1554977748452({
    "status": 0,
    "message": "query ok",
    "count": 10,
    "data": [
        {
            "id": "10003971829677132621",
            "title": "双井[地铁站]",
            "address": "地铁10号线",
            "category": "基础设施:交通设施:地铁站",
            "type": 2,
            "location": {
                "lat": 39.89351,
                "lng": 116.461802
            },
            "adcode": 110105,
            "province": "北京市",
            "city": "北京市",
            "district": "朝阳区"
        }
    ],
    "request_id": "12750947604550948"
})
posted @ 2020-08-17 18:05  Jruing  阅读(495)  评论(0编辑  收藏  举报