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
 def not_found(error):
19
 def not_found(error):
20
     return make_response(jsonify({'msg': 'Bad request', 'error': error}), 400)
20
     return make_response(jsonify({'msg': 'Bad request', 'error': error}), 400)
21
 
21
 
22
+
22
 @app.errorhandler(404)
23
 @app.errorhandler(404)
23
 def not_found(error):
24
 def not_found(error):
24
     return make_response(jsonify({'msg': 'Not found', 'error': error}), 404)
25
     return make_response(jsonify({'msg': 'Not found', 'error': error}), 404)
25
 
26
 
27
+
26
 @app.route('/api/v1.0/search', methods=['GET', 'POST'])
28
 @app.route('/api/v1.0/search', methods=['GET', 'POST'])
27
 def search_task():
29
 def search_task():
28
     task = dict(query='', selected_categories=['general'], pageno=1, settings=get_default_settings())
30
     task = dict(query='', selected_categories=['general'], pageno=1, settings=get_default_settings())
74
                     'infoboxes': search.infoboxes
76
                     'infoboxes': search.infoboxes
75
                     })
77
                     })
76
 
78
 
79
+
77
 @app.route('/api/v1.0/settings', methods=['GET'])
80
 @app.route('/api/v1.0/settings', methods=['GET'])
78
 def get_settings():
81
 def get_settings():
79
     return jsonify(get_default_settings())
82
     return jsonify(get_default_settings())
80
 
83
 
84
+
81
 def get_default_settings():
85
 def get_default_settings():
82
     engs = []
86
     engs = []
83
     langs = []
87
     langs = []
123
                'version': VERSION_STRING}
127
                'version': VERSION_STRING}
124
     return setting
128
     return setting
125
 
129
 
130
+
126
 def get_locale():
131
 def get_locale():
127
     locale = request.accept_languages.best_match(settings['locales'].keys())
132
     locale = request.accept_languages.best_match(settings['locales'].keys())
128
 
133
 
144
 
149
 
145
 
150
 
146
 if __name__ == '__main__':
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
+    )