0

I have seen similar topic here, but in my case, is a bit different since I am not using requests directly.

I am using Google Image Search api, and for some reason, I get this error requests.exceptions.ConnectionError: HTTPConnectionPool(host='mythirion.co.uk', port=80): Max retries exceeded with url: and the whole script crashes.

Since the requests is made on search method, I don't know how to skip it, with a try for example.

Azazel
  • 183
  • 1
  • 1
  • 10

2 Answers2

0

EDIT:

I have found that

try:
    gis.search(search_params=_search_params)
except Exception:
    print("Skipping image cuz GIS s*cks")

will do the trick.

I'm not sure why it doesn't stop searching images after an exception is thrown, but it seems to skip just the problematic image.

Azazel
  • 183
  • 1
  • 1
  • 10
-1

can you please provide your code, otherwise it's hard to understand what went wrong.

One thing that came to my mind is that the Google API requires an API key. Have you generated one? If not, follow the installation instructions here: https://pypi.org/project/Google-Images-Search/ If you generated one, you may have forgotten to enable the API in the Google Console. Or you may have reached the request limit.

~relevant

relevant
  • 14
  • 4