LEFT | RIGHT |
1 from flask import Flask, send_from_directory, jsonify, request | 1 from flask import Flask, send_from_directory, jsonify, request |
2 | 2 |
3 app = Flask(__name__) | 3 app = Flask(__name__) |
4 app.request_data = [] | 4 app.request_log = [] |
5 | 5 |
6 | 6 |
7 @app.before_request | 7 @app.before_request |
8 def log_request_info(): | 8 def log_request_info(): |
9 log = (request.url, request.get_data()) | 9 log = (request.url, str(request.get_data())) |
10 app.request_data.append(log) | 10 app.request_log.append(log) |
11 | 11 |
12 | 12 |
13 @app.route('/api/project/test/info', methods=['GET']) | 13 @app.route('/api/project/test/info', methods=['GET']) |
14 def info(): | 14 def info(): |
15 return jsonify( | 15 return jsonify( |
16 { | 16 { |
17 'languages': [ | 17 'languages': [ |
18 { | 18 { |
19 'name': 'German', | 19 'name': 'German', |
20 'code': 'de', | 20 'code': 'de', |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 return jsonify() | 105 return jsonify() |
106 | 106 |
107 | 107 |
108 @app.route('/api/project/test/delete-file', methods=['POST']) | 108 @app.route('/api/project/test/delete-file', methods=['POST']) |
109 def delete_file(): | 109 def delete_file(): |
110 return jsonify() | 110 return jsonify() |
111 | 111 |
112 | 112 |
113 @app.route('/api/project/test/export', methods=['GET']) | 113 @app.route('/api/project/test/export', methods=['GET']) |
114 def export(): | 114 def export(): |
115 return jsonify( | 115 return jsonify({'success': {'status': 'skipped'}}) |
116 { | |
117 'success': { | |
118 'status': 'skipped' | |
119 } | |
120 }, | |
121 ) | |
122 | 116 |
123 | 117 |
124 @app.route('/api/project/test/download/all.zip', methods=['GET']) | 118 @app.route('/api/project/test/download/all.zip', methods=['GET']) |
125 def get_zip(): | 119 def get_zip(): |
126 return send_from_directory('', 'all.zip') | 120 return send_from_directory('', 'all.zip') |
LEFT | RIGHT |