Skip to content

Instantly share code, notes, and snippets.

@fisherds
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save fisherds/ef5c59ffd31237fb9d07 to your computer and use it in GitHub Desktop.

Select an option

Save fisherds/ef5c59ffd31237fb9d07 to your computer and use it in GitHub Desktop.
Example from our ServerTime demo of a simple Python AppEngine handler that returns JSON
import json
import webapp2
class ServerTime(webapp2.RequestHandler):
def get(self):
self.response.headers["Content-Type"] = "application/json"
#self.response.headers.add_header("Access-Control-Allow-Origin", "*")
response = {"message": "Hello AJAX!"}
self.response.out.write(json.dumps(response))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment