Adding Google Search capability to code

Question: I cannot install googlesearch into python, every website I visit says that importing googlesearch_python or googlesearch-python will allow my code to perform google searches. everytime i try to import it it says that the googlesearch module either doesn’t exist or the search function is not defined.
How can I either adjust the googlesearch module to include search or should i try something else?

Error message: AttributeError: module ‘googlesearch’ has no attribute ‘search’

code snippet

Welcome to Ask! Can you please provide the link to your repl so we can take a look?

Hi @sboeckmph , welcome to the forums!
I have encountered this problem too!
I just tried using the googlesearch-python library with the code:

from googlesearch import search


It gave me <generator object search at 0x7f3b59ea6180>. I feel that we’re getting somewhere, but I don’t know where.

If search is a generator object, then could you loop through the items of search?