Can you tell us what error(s) you're getting now?

One thing, though, is that your query should be URL encoded.

On Thu, Mar 17, 2011 at 8:21 AM, crazywizard <[email protected]> wrote:

> Adam, I did the chnage but still getting errors
>
> code:
>
> import urllib2
> import simplejson
>
> url = ('https://ajax.googleapis.com/ajax/services/feed/find?' +
>       'v=1.0&q=http://www.nation.co.ke/-/1148/1148/-/view/asFeed/-/
> vtvnjq/-/index.xml&key=ABQIAAAA3yxjuwRO-TvCe0atz-bXURSxacz9-9-
> HUriveZcWWM1mnHlsLBS0fBq1eNV8LD9XYfb23n6t83I8Tw&userip=192.168.0.1')
>
> request = urllib2.Request(url, None, {'Referer': 'http://
> www.nation.co.ke/-/1148/1148/-/view/asFeed/-/vtvnjq/-/index.xml'})
> response = urllib2.urlopen(request)
>
> # Process the JSON string.
> results = simplejson.load(response)
> # now have some fun with the results...
> print results
>
> Output:
> import urllib2
> import simplejson
>
> url = ('https://ajax.googleapis.com/ajax/services/feed/find?' +
>       'v=1.0&q=http://www.nation.co.ke/-/1148/1148/-/view/asFeed/-/
> vtvnjq/-/index.xml&key=ABQIAAAA3yxjuwRO-TvCe0atz-bXURSxacz9-9-
> HUriveZcWWM1mnHlsLBS0fBq1eNV8LD9XYfb23n6t83I8Tw&userip=192.168.0.1')
>
> request = urllib2.Request(url, None, {'Referer': 'http://
> www.nation.co.ke/-/1148/1148/-/view/asFeed/-/vtvnjq/-/index.xml'})
> response = urllib2.urlopen(request)
>
> # Process the JSON string.
> results = simplejson.load(response)
> # now have some fun with the results...
> print results
>
> On Mar 17, 6:10 pm, crazywizard <[email protected]> wrote:
> > Jinx, this is the urlhttp://
> code.google.com/apis/feed/v1/jsondevguide.html#json_snippets_p...
> >
> > On Mar 17, 5:45 pm, Vision Jinx <[email protected]> wrote:
> >
> > > If your doing a feed search try this url
> >
> > >https://ajax.googleapis.com/ajax/services/feed/find?v=1.0&q=Official%.
> ..
> >
> > > Is that the URL you found in the docs somewhere?
> >
> > >https://ajax.googleapis.com/ajax/services/feed/feed
> >
> > > If so can you post a link to it?
> >
> > > On Mar 17, 8:34 am, crazywizard <[email protected]> wrote:
> >
> > > > Am trying to use the python implementation for the feed-api but when
> I
> > > > run the sample code, I get a 404 error. I have an api-key, so I don't
> > > > understand what's wrong.
> >
> > > > Sample code:
> >
> > > > import urllib2
> > > > import simplejson
> >
> > > > url = ('https://ajax.googleapis.com/ajax/services/feed/feed?'+
> > > >
>  'v=1.0&q=Official%20Google%20Blog&key=ABQIAAAA3yxjuwRO-TvCe0atz-
> > > > bXURSxacz9-9-
> > > > HUriveZcWWM1mnHlsLBS0fBq1eNV8LD9XYfb23n6t83I8Tw&userip=192.168.0.1')
> >
> > > > request = urllib2.Request(url, None, {'Referer': '
> http://www.nation.co.ke/'})
> > > > response = urllib2.urlopen(request)
> >
> > > > # Process the JSON string.
> > > > results = simplejson.load(response)
> > > > # now have some fun with the results...
> >
> > > > Output:
> >
> > > > [root@localhost Desktop]# python feed.py
> > > > Traceback (most recent call last):
> > > >   File "feed.py", line 8, in <module>
> > > >     response = urllib2.urlopen(request)
> > > >   File "/usr/lib/python2.6/urllib2.py", line 124, in urlopen
> > > >     return _opener.open(url, data, timeout)
> > > >   File "/usr/lib/python2.6/urllib2.py", line 395, in open
> > > >     response = meth(req, response)
> > > >   File "/usr/lib/python2.6/urllib2.py", line 508, in http_response
> > > >     'http', request, response, code, msg, hdrs)
> > > >   File "/usr/lib/python2.6/urllib2.py", line 433, in error
> > > >     return self._call_chain(*args)
> > > >   File "/usr/lib/python2.6/urllib2.py", line 367, in _call_chain
> > > >     result = func(*args)
> > > >   File "/usr/lib/python2.6/urllib2.py", line 516, in
> > > > http_error_default
> > > >     raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
> > > > urllib2.HTTPError: HTTP Error 404: Not Found
> >
> > > > P/S: Am a newbie, so keep it simple please.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google AJAX APIs" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-ajax-search-api?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-ajax-search-api?hl=en.

Reply via email to