Using the ElementTree Module to Generate Google Requests

November 20, 2003 | Fredrik Lundh

The Google Web API is a SOAP interface to Google’s search service, and a few other services. The ElementSOAP library includes a Python interface for the Google API.

 
from elementsoap.ElementGoogle import GoogleService

key = getlicensekey()

g = GoogleService(key)

response = g.doGoogleSearch("elementsoap")

for item in response.findall(".//item"):
    print item.findtext("URL"), repr(item.findtext("title"))

For background information and more examples, see the Using the ElementTree Module to Generate SOAP Messages article series, especially part 2, Talking to Google.

 

A Django site. rendered by a django application. hosted by webfaction.