forked from SudodevsHQ/drplantnik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths.py
29 lines (23 loc) · 1022 Bytes
/
s.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import requests
import json
start_index = 0
key = "AIzaSyAL2YTDGBmzJSvgrD52XdblSW6JJLYDfmE"
cx = "002299373873344878019:yf5tyg0gmnq"
q = "hello world"
url = "https://www.googleapis.com/customsearch/v1"
if start_index :
query_string = {"key":key,"cx":cx,"num":"10","q":q,"start":start_index}
else :
query_string = {"key":key,"cx":cx,"num":"10","q":q}
response = requests.request("GET", url, params=query_string)
json_data = json.loads(response.text)
for i in range(10):
print(json_data["items"][i]["link"])
# unirest.get("https://contextualwebsearch-websearch-v1.p.rapidapi.com/api/spelling/AutoComplete?text=do")
# .header("X-RapidAPI-Host", "contextualwebsearch-websearch-v1.p.rapidapi.com")
# .header("X-RapidAPI-Key", "8e1ebfcd66msh6964dd67b5771b3p1f73bajsnac7e451e7b58")
# .end(function (result) {
# console.log(result.status, result.headers, result.body);
# });
import requests
# resp = requests.get(url="https://contextualwebsearch-websearch-v1.p.rapidapi.com/api/spelling/AutoComplete?text=do")