Home  ||  Blog  ||  Projects  ||  Google Hacks  ||  Artificial Life  ||  Search  ||  About

ZGoogle 1.1

ZGoogle is a quick wrapper around Mark Pilgrims PyGoogle wrapper around the Google interface. I have only added a __init__ file to allow Zope to find the thing and added some code to make the API interface available in Python Scripts. Other then that, Mark did all the work.

After installing the product by unzipping the archive and putting everything in the products directory, create a new PythonScript and do something like this:

from Products.ZGoogle import setLicense, doGoogleSearch, getMetaData, getResults
setLicense( 'YourKeyGoesHere' )

print '<html><body>'
print '<form>'
print 'Search for:<input name=q>'
print '<input type="submit">'
print '</form>'

request = container.REQUEST

if request.form.has_key('q'):
    print '<hr>'
    q = request.form['q']+' osinga'
    data = doGoogleSearch( q )
    for a in getResults(data):
        print '<a href="%s">%s</a><br>' % ( a['URL'], a['title'] )

return printed

Note that the current implementation of this product uses getMetaData and getResults to circumvent the security around object members. If you know a better way, let me know at dmo@oberon.nl

Google History and Google Share contain some example applications of this code.

downloadable files

zgoogle.zipThe code of the product


Failure with Zope 2.6.1 and
by Lawouach
Hi,This product is nice but unfortunately it doesn't work with Zope 2.6.1 and under due to an issue with XML within Python.That's not a problem from ZGoogle but from PyGoogle.

Re: zope 2.6
by
Actually this site is running on Zope 2.6, so it should pose no problem.
Douwe

comment_3
by awk
I have error with zgoogle on zope 2.7 after requesting search:

Error Type: error
Error Value: (13, 'Permission denied')

How to fix? ...thanx.

another problem
by florian
hi!
i have a problem with 2.7 too...

Error Type: ImportError
Error Value: import of "Products.ZGoogle" is unauthorized

can anybody please help me/us?

flo

comment_5
by george
this is comment 5 & i'm 5

@florian
by timo
Hi Florian,

you just have to change

from Products.ZGoogle ...

to

from Products.zgoogle ...

best wishes,
timo

i18n problem
by
Works great but... any request with accents (é à ..) return an error:

Type de l'erreur
UnicodeDecodeError
Valeur de l'erreur
'ascii' codec can't decode byte 0xc3 in position 517: ordinal not in range(128)

Any idea ?

i18n solution
by
Well it works if you replace all the accents
( é -> e and so on)

and then call the function like this:

doGoogleSearch("évidemment", language='lang_fr')

hi
by john smith
hi

problem
by Who cares
I have a problem, in the head...

blaaa
by

comment_16
by

comment_12
by

comment_13
by

comment_14
by

comment_15
by

Frank
by Ryan

a
by ah
ahüüüüüüüüahüüüüüüü

comment_19
by kim


Post a comment
(c) Douwe Osinga 2001-2005, douwe.webfeedback@gmail.com Vertaling Nederlands Duits?