I’ve just started using Google’s search API to find addresses and the distances between those addresses. I used geopy for this, but, I often had the problem of not getting the correct addresses for my queries. I decided to experiment, therefore, with Google’s “Local Search” (http://code.google.com/apis/ajaxsearch/local.html).
Anyway, I wanted to ask if I could use the “Local Search” objects provided by the API within python. Something tells me that I can’t and that I have to use json. Does anyone know if there is a work around?
PS: Im trying to make something like this: http://www.google.com/uds/samples/random/lead.html … except a matrix type deal where the insides will be filled with distances between the addresses.
Thanks for reading!
As the docs say,
Python has no trouble processing Json (e.g. with the
jsonmodule in the standard library in 2.6 and better — there are also several third party ones e.g. for earlier releases,simplejsonbeing the direct precursor of today’s standardjson). So it’s all about using the RESTful interface correctly, as for most Google APIs not directly wrapped for this or that non-Javascript language.The code examples here are for Flash, Php, Java, Python, Perl — they all boil down to visiting a specific URL, e.g. with
urllib2in Python, and processing the returned Json, e.g. withsimplejsonin (pre-2.6) Python.All the queries in these RESTful code samples are for a web search, but local search is very similar, just start with the request URL with:
i.e., use
localin lieu ofwebin the URL.