Abhaykoul commited on
Commit
79b31ff
1 Parent(s): ea718cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -4,7 +4,23 @@ from flask import Flask, jsonify, request
4
  import google.generativeai as palm
5
  app = Flask(__name__)
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  @app.route('/search', methods=['POST'])
 
8
  def WEBScout2_search():
9
  data = request.get_json()
10
  if 'query' not in data:
 
4
  import google.generativeai as palm
5
  app = Flask(__name__)
6
 
7
+ @app.route('/search2', methods=['POST'])
8
+ def WEBScout_search2():
9
+ data = request.get_json()
10
+ if 'query' not in data:
11
+ return jsonify({'error': 'Query parameter missing'})
12
+
13
+ query = data['query']
14
+ limit = data.get('limit', 10) # Default limit to 10 if not provided
15
+ WEBS_instance = WEBS() # Instantiate WEBS without context manager
16
+ responses = []
17
+ for i, r in enumerate(WEBS_instance.text(query, region='wt-wt', safesearch='off', timelimit='y')):
18
+ if i == limit: # Use the custom limit
19
+ break
20
+ responses.append(r)
21
+ return jsonify(responses)
22
  @app.route('/search', methods=['POST'])
23
+
24
  def WEBScout2_search():
25
  data = request.get_json()
26
  if 'query' not in data: