On Tue, Feb 17, 2009 at 4:15 PM, Oltmans <rolf.oltm...@gmail.com> wrote: > > Hey all, > > I want to search Google.com using a specific keyword and I just want > to read back the response using Pyhon. After some thorough Googling I > realized that I probably need a Search API key to do that. Is that > correct? Now, I don't have a search key so is there a workaround? > Please enlighten me. > > Thanks, > Oltmans > -- > http://mail.python.org/mailman/listinfo/python-list
You just need to change your User-Agent so that Google doesn't know a Python script is making the request: import urllib2 headers = {'User-Agent' : 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.6) Gecko/2009020911 Ubuntu/8.04 (hardy) Firefox/3.0.6'} query = 'foo' req = urllib2.Request('http://www.google.com/search?&q=' + query, headers=headers) response = urllib2.urlopen(req) results = response.read() -- http://mail.python.org/mailman/listinfo/python-list