コード例 #1
0
 def needsdiagnosis_data():
     """Dumb pipeline for returning the JSON."""
     # TODO: Change this to a local file.
     json_data = get_remote_data(
         'http://www.la-grange.net/tmp/needsdiagnosis-timeline.json')
     if is_valid_args(request.args):
         json_data = get_json_slice(json_data, request.args.get('from'),
                                    request.args.get('to'))
     response = Response(response=json_data,
                         status=200,
                         mimetype='application/json')
     response.headers.add('Access-Control-Allow-Origin', '*')
     response.headers.add('Access-Control-Allow-Credentials', 'true')
     response.headers.add('Vary', 'Origin')
     return response
コード例 #2
0
 def weekly_reports_data():
     """Secondhand pipeline for returning weekly JSON data."""
     json_weekly_data = get_remote_data(
         'http://laghee.pythonanywhere.com/tmp/weekly_issues')
     if is_valid_args(request.args):
         json_weekly_data = get_json_slice(json_weekly_data,
                                           request.args.get('from'),
                                           request.args.get('to'))
     response = Response(response=json_weekly_data,
                         status=200,
                         mimetype='application/json')
     response.headers.add('Access-Control-Allow-Origin', '*')
     response.headers.add('Access-Control-Allow-Credentials', 'true')
     response.headers.add('Vary', 'Origin')
     return response
コード例 #3
0
 def sitewait_data():
     """Dumb pipeline for returning the JSON."""
     # TODO: Change this to a database query.
     json_data = get_remote_data(
         'http://laghee.pythonanywhere.com/tmp/sitewait_timeline')
     if is_valid_args(request.args):
         json_data = get_json_slice(json_data, request.args.get('from'),
                                    request.args.get('to'))
     response = Response(response=json_data,
                         status=200,
                         mimetype='application/json')
     response.headers.add('Access-Control-Allow-Origin', '*')
     response.headers.add('Access-Control-Allow-Credentials', 'true')
     response.headers.add('Vary', 'Origin')
     return response