Abhaykoul commited on
Commit
2635613
·
verified ·
1 Parent(s): 1c888c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -16,11 +16,10 @@ def search_text():
16
  timelimit = request.args.get('timelimit', None)
17
  safesearch = request.args.get('safesearch', 'moderate')
18
  region = request.args.get('region', 'wt-wt')
19
-
20
  results = []
21
- WEBS_instance = WEBS()
22
  with WEBS() as webs:
23
- for result in webs.text(query, max_results=max_results, timelimit=timelimit, safesearch=safesearch, region=region):
24
  results.append(result)
25
 
26
  return jsonify({'results': results})
 
16
  timelimit = request.args.get('timelimit', None)
17
  safesearch = request.args.get('safesearch', 'moderate')
18
  region = request.args.get('region', 'wt-wt')
19
+ WEBS_instance = WEBS() # Instantiate WEBS without context manager
20
  results = []
 
21
  with WEBS() as webs:
22
+ for result in enumerate(WEBS_instance.text(query, max_results=max_results, timelimit=timelimit, safesearch=safesearch, region=region)):
23
  results.append(result)
24
 
25
  return jsonify({'results': results})