Python crawler Baidu API call method and python crawler api call
Call Baidu API to obtain latitude and longitude information.
Import requestsimport jsonaddress = input ('enter location: ') par = {'address': address, 'key': 'cb649a25c1f81c1451adbeca73623251'} url = 'HTTP: // restapi.amap.com/v3/geocode/geo'res = requests. get (url, par) json_data = json. loads (res. text) geo = json_data ['geocodes '] [0] ['location'] longpolling = geo. split (',') [0] latitude = geo. split (',') [1] print (longpolling, latitude)
In fact, it is not difficult to call the API. Here is the get method. The parameter is the address and key. I found this key online and it should be usable.
Run the code.
Then, after processing the address in the encyclopedia, call the API to obtain the latitude and longitude, and then use the personal BDP to complete the figure.
The above python crawler Baidu API call method is a small part of the Content shared to everyone, I hope to give you a reference, but also hope you can support a lot of help homes.