Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 976845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:48:40+00:00 2026-05-16T03:48:40+00:00

I have successfully implemented this from android to a java httpservlet on google app

  • 0

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) {
        }
    } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:48:41+00:00Added an answer on May 16, 2026 at 3:48 am

    I know it’s been a long time. But I did solve this so I’ll post the solution.

    Android code:

            url = new URL(SERVER_URL);
            URLConnection connection = url.openConnection();
            connection.setDoOutput(true);
    
            OutputStreamWriter out = new OutputStreamWriter(
                                      connection.getOutputStream());
    
            String post_string;
            post_string = "deviceID="+tm.getDeviceId().toString();
    
            // send post string to server
            out.write(post_string);
            out.close();
    
            //grab a return string from server
            BufferedReader in = new BufferedReader(
                        new InputStreamReader(
                        connection.getInputStream()));
    
            Toast.makeText(context, in.readLine(), Toast.LENGTH_SHORT).show();
    

    And here’s the python server side, using Django with GAE:

    def upload(request):
        if request.method == 'POST':
            deviceID = measurement.deviceID = str(request.POST['deviceID'])
            return HttpResponse('Success!')
        else:
            return HttpResponse('Invalid Data')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 539k
  • Answers 539k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer How about using strtotime(): function generateTimes($date) { // convert to… May 17, 2026 at 2:23 am
  • Editorial Team
    Editorial Team added an answer It would be easier to use the DATE function to… May 17, 2026 at 2:23 am
  • Editorial Team
    Editorial Team added an answer OK Thanks Shaji for not answering, Any way I found… May 17, 2026 at 2:23 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have successfully implemented code to plot multiple locations on google maps dynamically. Solution:
I'm a complete noob to jquery and jquery ui but have successfully implemented a
I have successfully implemented a custom SimpleCursorAdapter for an AutoCompleteTextView, which suggests entries from
I have successfully implemented Forms Authentication in SSRS, so it now uses both Roles
I have successfully implemented interop beftween Win32 application and managed .Net dll as described
I'm just learning Qt with C++. I have successfully implemented signals and slots to
I have implemented a large list of views in a UIScrollView. I cannot use
I've started reading on zend framework and it's use with Doctrine and have implemented
I've tried to implement the Google Map View tutorial on the Android developer site,
I have three separate applications A, B and C. All of them use service

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.