403 Error from url open

156 views
Skip to first unread message

Hariharan Subramonyam

unread,
Jul 16, 2014, 1:19:48 PM7/16/14
to google-a...@googlegroups.com
I have a service that has to query the Bing Search API and returns search results in Json format. 

I followed this example to set up my python code :  http://www.guguncube.com/2771/python-using-the-bing-search-api

However, when I call my service, I get a 403 error from App Engine. Here is the log:


35.2.131.132 - - [16/Jul/2014:09:24:41 -0700] "POST /newsSearch HTTP/1.1" 500 844 - "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36"
3:1405527881.794270 HTTP Error 403: Forbidden
: Traceback (most recent call last):
:   File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
:     rv = self.handle_exception(request, response, e)
:   File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
:     rv = self.router.dispatch(request, response)
:   File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
:     return route.handler_adapter(request, response)
:   File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
:     return handler.dispatch()
:   File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
:     return self.handle_exception(e, self.app.debug)
:   File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
:     return method(*args, **kwargs)
:   File "/base/data/home/apps/*APP NAME*/main.py", line 634, in post
:     response = request_opener.open(request)
:   File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 410, in open
:     response = meth(req, response)
:   File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 523, in http_response
:     'http', request, response, code, msg, hdrs)
:   File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 448, in error
:     return self._call_chain(*args)
:   File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 382, in _call_chain
:     result = func(*args)
:   File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 531, in http_error_default
:     raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
: HTTPError: HTTP Error 403: Forbidden



Please advise how to fix this ? 

Many thanks.

--Hari 

Vinny P

unread,
Jul 18, 2014, 1:05:37 AM7/18/14
to google-a...@googlegroups.com
On Wed, Jul 16, 2014 at 12:19 PM, Hariharan Subramonyam <hari...@umich.edu> wrote:
I have a service that has to query the Bing Search API and returns search results in Json format. 
I followed this example to set up my python code :  http://www.guguncube.com/2771/python-using-the-bing-search-api
However, when I call my service, I get a 403 error from App Engine. Here is the log:
35.2.131.132 - - [16/Jul/2014:09:24:41 -0700] "POST /newsSearch HTTP/1.1" 500 844 - "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36"
3:1405527881.794270 HTTP Error 403: Forbidden

Please advise how to fix this ? 


It looks like the Bing API is not accepting your credentials. Can you try regenerating your access keys? Did you make any changes to the code from your linked site?
 
 
-----------------
-Vinny P
Technology & Media Consultant
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com

Reply all
Reply to author
Forward
0 new messages