1

I am sending data to the Google App Engine via the httpRequest get method. This goes perfectly well and gets stored in the datastore. But how to return the result from the Google App Engine via HTTP or is there any other method for doing the same?

Any help will be useful.

2 Answers 2

2

Personally, I prefer to using the model to define my Data

from google.appengine.ext import db

class SomeData(db.model):
    attr1 = db.StringProperty(required=Ture)
    attr2 = db.StringProperty()
    ..........

Then, I could retrieve the data with

data = SomeData.get_by_id(id)

For the routing

routes = [
    (r'/SomeData/(.*)', DataHandler)
]

Data Handler

class DataHandler(BaseHandler):
    def get(self, id):
        data = SomeData.get_by_id(int(id))
        (render the data in the format you like here)

Now, you could access your data by id through the URL: http://{your site}/SomeData/{id}

Sign up to request clarification or add additional context in comments.

Comments

0
class YourClass(webapp.RequestHandler):
  def get(self):
    self.response.out.write("Your Output")

That is the basic template to write something out of for get method in GAE. Did you follow the App Engine tutorial on creating a guestbook application, if not, I think that is a good place to start.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.