Browse Source

solve flake8 error

moritan 9 years ago
parent
commit
927433c9dd
1 changed files with 11 additions and 1 deletions
  1. 11
    1
      searx/rest-server.py

+ 11
- 1
searx/rest-server.py View File

@@ -19,10 +19,12 @@ cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
19 19
 def not_found(error):
20 20
     return make_response(jsonify({'msg': 'Bad request', 'error': error}), 400)
21 21
 
22
+
22 23
 @app.errorhandler(404)
23 24
 def not_found(error):
24 25
     return make_response(jsonify({'msg': 'Not found', 'error': error}), 404)
25 26
 
27
+
26 28
 @app.route('/api/v1.0/search', methods=['GET', 'POST'])
27 29
 def search_task():
28 30
     task = dict(query='', selected_categories=['general'], pageno=1, settings=get_default_settings())
@@ -74,10 +76,12 @@ def search_task():
74 76
                     'infoboxes': search.infoboxes
75 77
                     })
76 78
 
79
+
77 80
 @app.route('/api/v1.0/settings', methods=['GET'])
78 81
 def get_settings():
79 82
     return jsonify(get_default_settings())
80 83
 
84
+
81 85
 def get_default_settings():
82 86
     engs = []
83 87
     langs = []
@@ -123,6 +127,7 @@ def get_default_settings():
123 127
                'version': VERSION_STRING}
124 128
     return setting
125 129
 
130
+
126 131
 def get_locale():
127 132
     locale = request.accept_languages.best_match(settings['locales'].keys())
128 133
 
@@ -144,4 +149,9 @@ def get_locale():
144 149
 
145 150
 
146 151
 if __name__ == '__main__':
147
-    app.run(debug=True)
152
+    app.run(
153
+        debug=settings['general']['debug'],
154
+        use_debugger=settings['general']['debug'],
155
+        port=settings['server']['port'],
156
+        host=settings['server']['bind_address']
157
+    )