arrrlo / Google-Images-Search

[PYTHON] Search for image using Google Custom Search API and resize & crop afterwards
MIT License
175 stars 34 forks source link

None returned by gis.search() #108

Closed SvenGroen closed 3 years ago

SvenGroen commented 3 years ago

Hi, sorry if this is a stupid question, but it is my first time using the google API and I am not sure where I made the mistake.

After executing:

    gis = GoogleImagesSearch(API_KEY, PROJECT_CX)
    _search_params = {
        'q': 'cat',
        'num': 10,
    }
    result = gis.search(_search_params)

result is None.

API_KEY is my api-key and PROJECT_CX is my custom search engine ID that can be found above the tick box where image search should be enabled. Or what exactly is the Project_cx supposed to be?

The Google API site shows me that there is some traffic coming through, but gis.search() seems to return "None" whatever I am doing.

Can you help me out if I made a mistake or any hint on why None is returned?

(Also, not sure if this is important: I had a "curses"-module import error, at the beginning. It was gone after "pip install windows-curses")

cheers, Sven

arrrlo commented 3 years ago

Hi @SvenGroen,

It's very simple: gis.search always returns None To get the results use it like this:

gis.search(_search_params)
result = gis.results()

Cheers! Ivan.