Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appengine URL API for Search Doesn't Work From Browser #1

Open
kevincon opened this issue Jun 5, 2011 · 3 comments
Open

Appengine URL API for Search Doesn't Work From Browser #1

kevincon opened this issue Jun 5, 2011 · 3 comments
Assignees

Comments

@kevincon
Copy link
Collaborator

kevincon commented Jun 5, 2011

I tried visiting this url in my browser:
http://smspersonfinder.appspot.com/search?message=Dan%20Brown

That should send the message "Dan Brown" to appengine.

I get this python traceback (most likely a problem with encoding/decoding URLs on both sides:

Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/init.py", line 700, in call
handler.get(_groups)
File "/base/data/home/apps/ssmspersonfinder/1.350924882319313693/main.py", line 196, in get
result = search.handle(message)
File "/base/data/home/apps/s
smspersonfinder/1.350924882319313693/search/init.py", line 186, in handle
data = urllib2.urlopen("%s%s" % (host, query_uri)).read()
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 124, in urlopen
return _opener.open(url, data)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 381, in open
response = self._open(req, data)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 399, in _open
'_open', req)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 360, in _call_chain
result = func(_args)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 1122, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 1087, in do_open
r = h.getresponse()
File "/base/python_runtime/python_dist/lib/python2.5/httplib.py", line 197, in getresponse
self._allow_truncated, self._follow_redirects)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/urlfetch.py", line 260, in fetch
return rpc.get_result()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 592, in get_result
return self.__get_result_hook(self)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/urlfetch.py", line 358, in _get_fetch_result
raise DownloadError(str(err))
DownloadError: ApplicationError: 2

@ghost ghost assigned gfernandes Jun 5, 2011
@lionelyoung
Copy link
Collaborator

The code isn't urlencoding the string when using the web interface.

Try this:

Build query string

q = {'something': something,
'goes': goes,
'here': here}

query = urllib.urlencode(q)

url="http://smspersonfinder.appspot.com/search?%s" % query

@dbro
Copy link
Owner

dbro commented Jun 7, 2011

this one word query works ok for me:
http://smspersonfinder.appspot.com/search?message=bauer

@kevincon
Copy link
Collaborator Author

kevincon commented Jun 7, 2011

Yeah, unfortunately the issue has to do with using characters that require
encoding, like spaces (which would become %20 in the URL). The appengine
side is not expecting someone to input from a browser I think.

But I was thinking we should build in support for that, so if someone tried it they wouldn't see the Python traceback. :P

On Tue, Jun 7, 2011 at 4:34 PM, dbro <
reply@reply.github.com>wrote:

this one word query works ok for me:
http://smspersonfinder.appspot.com/search?message=bauer

Reply to this email directly or view it on GitHub:
#1 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants