SimpleSam commited on
Commit
8305bf3
·
verified ·
1 Parent(s): 154882b

Update tools/manyata.py

Browse files
Files changed (1) hide show
  1. tools/manyata.py +22 -0
tools/manyata.py CHANGED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import urllib.parse
3
+
4
+ #----------------- CONFIGURATION -----------------------------
5
+ GOOGLE_API_KEY = "GOOGLE API key"
6
+ GOOGLE_CX = ""
7
+
8
+ def duckduckgo_search(query):
9
+ """Search duck duck go using instant Answer API."""
10
+ try:
11
+ url = "https://api.duckduckgo.com/"
12
+ params = {"q": query, "format": "json", "no_redirect": 1, "no_html":1}
13
+ response = requests.get(url, params=params, timeout=10)
14
+ response.raise_for_status()
15
+ data = response.json()
16
+ results = []
17
+ if data.get("AbstractText"):
18
+ results.append({
19
+ ""
20
+ })
21
+ except error:
22
+