Abhaykoul commited on
Commit
5cc9742
·
verified ·
1 Parent(s): 9ade9a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -18,7 +18,20 @@ def WEBScout2_search():
18
  break
19
  responses.append(r)
20
  return jsonify(responses)
 
 
 
 
 
21
 
 
 
 
 
 
 
 
 
22
  @app.route('/health', methods=['GET'])
23
  def health_check():
24
  return jsonify({'status': 'ok'})
 
18
  break
19
  responses.append(r)
20
  return jsonify(responses)
21
+ @app.route('/mws', methods=['POST'])
22
+ def WEBScout2_search():
23
+ data = request.get_json()
24
+ if 'query' not in data:
25
+ return jsonify({'error': 'Query parameter missing'})
26
 
27
+ query = data['query']
28
+ WEBS_instance = WEBS() # Instantiate WEBS without context manager
29
+ responses = []
30
+ for i, r in enumerate(WEBS_instance.text(query, region='wt-wt', safesearch='off', timelimit='y')):
31
+ if i == 10: # Limiting the results to 10
32
+ break
33
+ responses.append(r)
34
+ return jsonify(responses)
35
  @app.route('/health', methods=['GET'])
36
  def health_check():
37
  return jsonify({'status': 'ok'})