Baidu Maps Geocoding API is a free open the API, the default quota one million times / day.


>>> import geocoder # pip install geocoder
>>> g ='中国', key='<API KEY>')
>>> g.json

Reverse Geocoding

>>> import geocoder
>>> latlng = [45.3, -105.1]
>>> g =, method='reverse', key='<API KEY>')
>>> g.json

Command Line Interface

$ geocode '中国' --provider baidu

Environment Variables

To make sure your API key is store safely on your computer, you can define that API key using your system’s environment variables.

$ export BAIDU_API_KEY=<Secret API Key>
$ export BAIDU_SECURITY_KEY=<Secret API Security Key>


  • location: Your search location you want geocoded.
  • key: Baidu API key.
  • sk: Baidu API security key. Use with key. For Baidu developers.
  • method: (default=geocode) Use the following:
    • geocode
    • reverse