Fetch callback

17 views
Skip to first unread message

ehmo

unread,
Jan 18, 2009, 8:54:08 PM1/18/09
to google-a...@googlegroups.com
Hey guys,
i'm trying to do something like this

class check(webapp.RequestHandler):

def get(self):

url = self.request.get('url')
self.response.out.write(url)

class MainHandler(webapp.RequestHandler):
def get(self):

url = "http://google.com"
query_args = {'url':url}

check = urllib.urlencode(query_args)
test = urlfetch.fetch('/check'+check)

def main():
application = webapp.WSGIApplication([('/', MainHandler),('/check',check)],
debug=True)
wsgiref.handlers.CGIHandler().run(application)


if __name__ == '__main__':
main()

but result is always

raise InvalidURLError(str(e))
InvalidURLError: ApplicationError: 1

i can't find anything in docu about how to do something like this,
maybe someone can help me? i'm preparing that check function for
javascript ajax call, that's the reason why i'm using fetch for this.

thnx

----------
oooo [who cares?]
http://blog.synopsi.com

Gipsy Gopinathan

unread,
Jan 18, 2009, 10:04:49 PM1/18/09
to google-a...@googlegroups.com
I think you have to use the absolute path  in your fetch call
ie  test = urlfetch.fetch('http://yourappid.appspot.com/check'+check)
--
cheers
Gipsy

Alexander Kojevnikov

unread,
Jan 19, 2009, 4:07:31 AM1/19/09
to Google App Engine
Are you trying to run this from the SDK? If so, the SDK cannot serve
more than one request at a time.

A workaround is described in the documentation:
http://code.google.com/appengine/docs/python/tools/devserver.html#Using_URL_Fetch

Andy Freeman

unread,
Jan 19, 2009, 5:30:41 PM1/19/09
to Google App Engine
And, even if you're trying to do it in a deployed version, there's no
guarantee that the second call will be processed by the same
interpreter. In fact, I think that you're guaranteed that the second
call will be processed by a different interpreter.

On Jan 19, 1:07 am, Alexander Kojevnikov <alexan...@kojevnikov.com>
wrote:
> Are you trying to run this from the SDK? If so, the SDK cannot serve
> more than one request at a time.
>
> A workaround is described in the documentation:http://code.google.com/appengine/docs/python/tools/devserver.html#Usi...
> > oooo [who cares?]http://blog.synopsi.com- Hide quoted text -
>
> - Show quoted text -

djidjadji

unread,
Jan 20, 2009, 7:49:38 PM1/20/09
to google-a...@googlegroups.com
And don't forget the '?' character

test = urlfetch.fetch('http://yourappid.appspot.com/check?'+check)

2009/1/19 Gipsy Gopinathan <gipsy...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages