Hi,

Not knowing anything about YQL, it seems like the error message my
indicate that the URL query parameter for a call to yahooapis should
look something like "/yql?q=TEXT", and the URL you have generated
would not look like that, hence the error message you are seeing form
Yahoo!.

Logging would help determine what URL you are generating, but locals()
generally returns something like:
{'logging': <module 'logging' from
'/base/python_dist/lib/python2.5/logging/__init__.py'>, 'users':
<module 'google.appengine.api.users' from
'/base/python_lib/versions/1/google/appengine/api/users.py'>,
'__builtins__': <module '__builtin__' (built-in)>, 'db': <module
'google.appengine.ext.db' from
'/base/python_lib/versions/1/google/appengine/ext/db/__init__.py'>,
'sys': <module 'sys' (built-in)>, '__name__': '__main__', 'os':
<module 'os' from '/base/python_dist/lib/python2.5/os.py'>, '__doc__':
None}

and URL encoding and appending this dictionary to the URL provided
doesn't seem like it would produce a sensible URL.

-Marzia

On Sun, Feb 1, 2009 at 9:26 AM, Markanday Singh <mark.d...@gmail.com> wrote:
>
> Following code is return "You must specify a yql statement (q=) to
> execute"
>
> I don't know where parameter q is getting lost
>
>
> import cgi
> import wsgiref.handlers
> import os
> from google.appengine.api import users
> from google.appengine.ext import webapp
> from google.appengine.ext import *
> from google.appengine.ext.webapp import template
> from google.appengine.api import urlfetch
> from cgi import parse_qs, escape
> import simplejson, urllib
>
> def get_yql(q,format):
>    params=locals()
>    payload= urllib.urlencode(params)
>    base_url=u'http://query.yahooapis.com/v1/public/yql?'
>    myurl= base_url + payload
>    return urlfetch.fetch(url=myurl);
> class jsontest(webapp.RequestHandler):
>  def get(self):
>    response=get_yql('select title,abstract from search.web where
> query="pizza"','json');
>    self.response.out.write(response.content);
>
> def main():
>  application = webapp.WSGIApplication(
>                       [('/jsontest',jsontest)
>                                        ],
>                                       debug=True)
>  wsgiref.handlers.CGIHandler().run(application)
>
> if __name__ == "__main__":
>  main()
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to