コード例 #1
0
 def get(self):
     objects = [
         {'url': 'http://www.caltrain.com/schedules/realtime/stations/mountainviewstation-mobile.html'},
         {'url': 'http://benfry.com/distellamap/'},
         {'url': 'http://en.wikipedia.org/wiki/Le_D%C3%A9jeuner_sur_l%E2%80%99herbe'},
         {'url': 'http://sfmoma.org'}
     ]
     metadata_output = helpers.BuildResponse(objects)
     output = {
       'metadata': metadata_output
     }
     self.response.headers['Content-Type'] = 'application/json'
     json_data = json.dumps(output);
     self.response.write(json_data)
コード例 #2
0
    def post(self):
        input_data = self.request.body

        try:
            input_object = json.loads(
                input_data)  # TODO: Data is not sanitised.
            objects = input_object.get('objects', [])
        except:
            objects = []

        metadata_output = helpers.BuildResponse(objects)
        output = {'metadata': metadata_output}
        self.response.headers['Content-Type'] = 'application/json'
        json_data = json.dumps(output)
        self.response.write(json_data)
コード例 #3
0
    def post(self):
        input_data = self.request.body

        try:
            input_object = json.loads(
                input_data)  # TODO: Data is not sanitised.
            objects = input_object.get('objects', [])
            secure_only = bool(
                input_object.get('secureOnly', helpers.DEFAULT_SECURE_ONLY))
        except:
            objects = []
            secure_only = helpers.DEFAULT_SECURE_ONLY

        output = helpers.BuildResponse(objects, secure_only)

        self.response.headers['Content-Type'] = 'application/json'
        json_data = json.dumps(output)
        self.response.write(json_data)