I have successfully implemented this from android to a java httpservlet on google app engine, but I'd like to use python instead for the server side. I'm new to python. Has anyone done this? I have the guestbook example up and running, but I can't seem to send posts from my android app to the server.
I'd also like to issue a string response back to the client like "success".
A guiding hand would be much appreciated.
Thanks
***Client side java:
URL url = new URL(Const.SERVER_NAME);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
OutputStreamWriter out = new OutputStreamWriter(
connection.getOutputStream());
out.write("content=12345");
out.close();
***Server side Python:
class Upload(webapp.RequestHandler):
def post(self):
greeting.content = self.request.get('content')
greeting.put()
***Server side Java (working)
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
String instring = request.getParameter("content")
// set the response code and write the response data
response.setStatus(HttpServletResponse.SC_OK);
OutputStreamWriter writer = new OutputStreamWriter(response.getOutputStream());
writer.write("Success");
writer.flush();
writer.close();
} catch (IOException e) {
try{
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.getWriter().print(e.getMessage());
response.getWriter().close();
} catch (IOException ioe) {
}
}