Note, outside of GAE, the fetch function simply uses urllib2.urlopen.
On Friday, September 16, 2011 10:57:15 AM UTC-4, Eric wrote:
>
> Good point, Anthony. Thanks for mentioning the fetch() function.
> Learned something new.
>
> It's amazing how much information is compressed into that book. I get
> something new out of it each time I go back and read a chapter.
>
> On Sep 15, 10:12 pm, Anthony <[email protected]> wrote:
> > On Thursday, September 15, 2011 5:55:30 PM UTC-4, Eric wrote:
> >
> > > I've not used any of the google api, but if you just need to access
> > > and parse a json formatted api, you would need to use urllib or
> > > urllib2 to make the request, then use simplejson or json or parse the
> > > results:
> >
> > > import urllib
> > > import simplejson
> >
> > > req = urllib.urlopen("http://google.com/api.json") ##<-example only
> >
> > Also, note that web2py includes its own fetch() function in gluon.tools
> to
> > fetch a url -- the difference from the above is that it works on GAE as
> well
> > (the above does not). Seehttp://
> web2py.com/book/default/chapter/12#Fetching-an-external-URL(note,
> > the book incorrectly refers to google.tools, but should be gluon.tools).
> >
> > Anthony