Skip to content

Instantly share code, notes, and snippets.

@rvvvt
Created January 18, 2019 07:19
Show Gist options
  • Save rvvvt/971757b53e0cdd8099a0d71b17f6fd63 to your computer and use it in GitHub Desktop.
Save rvvvt/971757b53e0cdd8099a0d71b17f6fd63 to your computer and use it in GitHub Desktop.
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