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.

Reply via email to