I have an url like below
http://myappname.appspot.com/openthisurl
And in my view.py, I create an gaemechanize browser like this
def test(request):
###1. CREATE BROWSER
br = gaemechanize.Browser()
# set cookies
cookies = cookielib.LWPCookieJar()
br.set_cookiejar(cookies)
# browser settings (used to emulate a browser)
br.set_handle_equiv(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.set_debug_http(False)
br.set_debug_responses(False)
br.set_debug_redirects(False)
br.set_handle_refresh(gaemechanize.HTTPRefreshProcessor(), max_time=1)
br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
###Open http://myappname.appspot.com/openthisurl inside br
br.open('http://myappname.appspot.com/openthisurl')
#Do something
br.select_form(nr=0) # select the form
return Response('Ok')
And this is the error I get
Internal Server Error
Traceback (most recent call last):
File "/base/data/home/apps/s~myappname/4.376620314915414228/kay/app.py", line 371, in get_response response = view_func(request, **values)
File "/base/data/home/apps/s~myappname/4.376620314915414228/myapp/views.py", line 3669, in test br.open('http://myappname.appspot.com/openthisurl')
File "/base/data/home/apps/s~myappname/4.376620314915414228/myapp/gaemechanize/_mechanize.py", line 209, in open return self._mech_open(url, data, timeout=timeout)
File "/base/data/home/apps/s~myappname/4.376620314915414228/myapp/gaemechanize/_mechanize.py", line 236, in _mech_open response = UserAgentBase.open(self, request, data)
File "/base/data/home/apps/s~myappname/4.376620314915414228/myapp/gaemechanize/_opener.py", line 194, in open response = urlopen(self, req, data)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 422, in _open '_open', req)
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/apps/s~myappname/4.376620314915414228/myapp/gaemechanize/_googleappengine.py", line 731, in http_open return self.do_open(httplib.HTTPConnection, req)
File "/base/data/home/apps/s~myappname/4.376620314915414228/myapp/gaemechanize/_googleappengine.py", line 708, in do_open raise URLError(err)
URLError: