Skip to content

Instantly share code, notes, and snippets.

@sagoyanfisic
Last active March 16, 2018 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sagoyanfisic/d5597533fe9adb96908710737dc7c0e6 to your computer and use it in GitHub Desktop.
Save sagoyanfisic/d5597533fe9adb96908710737dc7c0e6 to your computer and use it in GitHub Desktop.
import webapp2
import json
from google.appengine.ext.webapp import template
import os
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')
class PrincipalPage(webapp2.RequestHandler):
def get(self):
template_values = dict()
path = os.path.join(os.path.dirname(__file__), 'templates', 'index.html')
self.response.out.write(template.render(path, template_values))
class ResponseExample(webapp2.RequestHandler):
def get(self, **kwargs):
html = '<a href="%s">test item</a>' % self.url_for('view', item='test')
self.response.out.write(html)
class ResponseJsonAPi(webapp2.RequestHandler):
def get(self):
data = {'status':'','operacion':'','origen':'','vuelo':'','destino':''}
self.response.headers['Content-Type'] = 'application/json'
self.response.headers.add_header('Access-Control-Allow-Origin', '*')
self.response.write(json.dumps(data))
app = webapp2.WSGIApplication([
# SALIDAS
# salidas/nacional/dia/
('/v1/', ResponseJsonAPi),
('/', MainPage),
], debug=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment