Created
January 18, 2019 07:19
-
-
Save rvvvt/971757b53e0cdd8099a0d71b17f6fd63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import csv | |
ENGINE_URL = "https://searx.me/?q=%s&format=json" | |
def loop(): | |
with open('firstten.csv', 'r') as a: | |
reader = csv.reader(a, lineterminator='\n') | |
for row in reader: | |
search(row) | |
def search(query, fmt="json"): | |
r = requests.get(ENGINE_URL % query) | |
if r.status_code == 200: | |
print(r.text) | |
return True, json.loads(r.text) | |
return False, {"error": r.text, "code": r.status_code} | |
def main(): | |
# loop() | |
if __name__ == "__main__": | |
exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment