Geocoding addresses using Python
In this section, we'll show you how to make calls to the Bing Maps Locations API using both a direct call to the URL via the GET
method (which is ultimately equivalent to the example call you made earlier via the browser) and a dedicated Python Software Development Kit (SDK) that facilitates the query.
Using an explicit GET request
If we want to receive geocoding data for an address from the Bing API, we need to make a request to the web service by passing the address of interest as a parameter. The parameters are passed through appropriate concatenation of the parameters with the URL of the endpoint. In our case, the full format of the endpoint URL useful for geocoding an address is as follows:
The following is the definition of each string token you can see in Figure 9.3:
base_url
: The endpoint URL string, that is, http://dev...