To run this:
pip3 install -r requirements.txt
- You need to setup a CSE account, check the tutorial on how you can set up one.
- Change
API_KEY
andSEARCH_ENGINE_ID
to yours, and then:This will use the query "python" to search for results, here is a cropped output:python search_engine.py "python"
========== Result #1 ========== Title: Welcome to Python.org Description: The official home of the Python Programming Language. URL: https://www.python.org/ ========== Result #2 ========== Title: The Python Tutorial — Python 3.8.2 documentation Description: It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python's elegant syntax and dynamic typing, together ... URL: https://docs.python.org/3/tutorial/ ========== Result #3 ========== Title: Download Python | Python.org Description: Looking for Python with a different OS? Python for Windows, Linux/UNIX, Mac OS X, Other. Want to help test development versions of Python? Prereleases ... URL: https://www.python.org/downloads/