Here is my code, it was working properly before I was not getting an error while using it. I don't understand how it happened even though I didn't change with it. :
results = []
for query in my_list:
results.append(search(query, tld="com", num=1, stop=1, pause=2))
Error:
results.append(search(query, tld="com", num=1, stop=1, pause=2))
TypeError: search() got an unexpected keyword argument 'tld'
It is from the google
python package. it is still working of all the versions.
query
: query string that we want to search for.tld
: tld stands for top level domain which means we want to search our result on google.com or google.in or some other domain.lang
: lang stands for language.num
: Number of results we want.start
: First result to retrieve.stop
: Last result to retrieve. Use None to keep searching forever.pause
: Lapse to wait between HTTP requests. Lapse too short may cause Google to block your IP. Keeping significant lapse will make your program slow but its safe and better option.Return
: Generator (iterator) that yields found URLs. If the stop parameter is None the iterator will loop forever.There is one more python package with the module name as googlesearch
Link here
Since it might be installed on your environment, this might be calling this module which does not have these parameters included.
pip install beautifulsoup4
and pip install google
pip install googlesearch-python
python package