Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle App Engine performs different from its local appserver
    primarykey
    data
    text
    <p>The following function will extract URLs form Google search result. It works well in <code>dev_appserver</code>(localhost) but when I deployed it on Google App Engine it show some Error.</p> <p><strong>Program:</strong></p> <pre><code>def googleSearch(keyword): from re import findall from urllib2 import build_opener from urllib import quote, unquote urlregex = r'&lt;a[ ]href="/url\?q=(http://.+?)[&amp;]' searchURL = 'https://www.google.com/search?q=' + quote(keyword, safe = '') # https will exclude Cached results #Google opener = build_opener() opener.addheaders = [('User-agent', 'Mozilla/5.0')] pagesource = opener.open(searchURL).read() result = findall(urlregex, pagesource) print result resultlist = [] for url in result: resultlist.append(unquote(url)) resultlist = sorted(set(resultlist), key=resultlist.index) return resultlist </code></pre> <p><strong>GAE Error:</strong></p> <pre><code>Internal Server Error The server has either erred or is incapable of performing the requested operation. 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/s~crawlnsearch/1.370098233684025667/main.py", line 56, in get result = googleSearch(q) File "/base/data/home/apps/s~crawlnsearch/1.370098233684025667/goosearch.py", line 15, in googleSearch pagesource = opener.open(searchURL).read() 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 442, in error result = 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 629, in http_error_302 return self.parent.open(new, timeout=req.timeout) 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 503: Service Unavailable </code></pre> <p>Did any one know solution for this problem.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload