1

I am getting

DownloadError: ApplicationError: 2 (11004, 'getaddrinfo failed')

I'm making an API call to an application deployed on Tomcat on my machine and expecting a XML response, but doesn't work. Can someone propose a solution or an alternate route?

I am working on an IT build laptop and suspected that that could be the issue so I tried from a laptop that is not behind firewall and not on company network, but that didnt' help either.

Code Snippet:

base_url = 'http://localhost:8080/recomendations/'
url = (base_url + 'api/1.0/otherusersalsoviewed?' + urlencode(args))
req = urlfetch.fetch(url, None, urlfetch.GET, {}, False, True, 60, False) 
if req.status_code==200:
   root = ElementTree(fromstring(req.content)).getroot() 

Any idea what is wrong?

Kevin Bedell
  • 13,254
  • 10
  • 78
  • 114
greenwasp
  • 31
  • 2

2 Answers2

2

Note that the url you are specifying is pointing to localhost, which means 'this computer' (see http://en.wikipedia.org/wiki/Localhost), i.e. when you deploy your app to GAE localhost refer to GAE, which is meaningless.

Sebastian Kreft
  • 7,819
  • 3
  • 24
  • 41
  • Also, the port number is an issue here. – Christopher Ramírez Jun 27 '12 at 22:57
  • I have used my ip address in the deployed version. Still getting the same error! – greenwasp Jun 28 '12 at 00:15
  • @Christopher Ramirez.. Why is the port number an issue? In my deployed application i have used http://ipadress:8080/recommendations/ Isn't that ok? – greenwasp Jun 28 '12 at 00:24
  • Is your ip static? Try running the snippet with your IP address in http://shell.appspot.com/ – Sebastian Kreft Jun 28 '12 at 00:29
  • ok.. So my ip is static and I did try my snippet in shell. I am getting a download error there as well :( – greenwasp Jun 28 '12 at 02:19
  • "/base/python_runtime/python_lib/versions/1/google/appengine/api/urlfetch.py", line 365, in _get_fetch_result raise DownloadError(str(err)) DownloadError: ApplicationError: 2 – greenwasp Jun 28 '12 at 02:20
  • @user1481650 because production server does not use 8080 port. It uses 80 or 447 for SSL. Avoid using absolute URLs. Try instead `base_url = '/recomendations/'` which should work on development and production. – Christopher Ramírez Jun 28 '12 at 05:06
  • @Christopher Ramírez, as I understood user1481650 is trying to connect to another service, which is a Tomcat deployment. – Sebastian Kreft Jun 28 '12 at 17:37
  • @user1481650, I suggest you to edit your original post to include the error you are getting and to remove 'localhost' from your url. – Sebastian Kreft Jun 28 '12 at 17:38
0

Just in case, I was geting:

ApplicationError: 2

I fixed removing references to users.create_logout_url()

nbari
  • 25,603
  • 10
  • 76
  • 131