Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 1 Notebook: search_images throws HTTPStatusError: Client error '403 Forbidden' #34

Open
ChrisTho23 opened this issue Jul 13, 2024 · 0 comments

Comments

@ChrisTho23
Copy link

ChrisTho23 commented Jul 13, 2024

The search_images function in the first notebook does not work neither for me nor many other users (see notebook comments). I tracked this down to an issue with the duckduckgo_search library. According to this (thread)[https://github.com/deedy5/duckduckgo_search/issues/136], the following code solves the problem. I tried it out and indeed, I can run the notebook without any problems.

from duckduckgo_search import DDGS
from fastcore.foundation import L

def search_images(term, max_images=30):
    print(f"Searching for '{term}'")
    with DDGS(headers = {"Accept-Encoding": "gzip, deflate, br"}) as ddgs:
        results = ddgs.images(keywords=term)
        return L(results).itemgot('image')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant