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

Throwing error on serpapi.search #17

Open
hilmanski opened this issue Nov 14, 2024 · 0 comments
Open

Throwing error on serpapi.search #17

hilmanski opened this issue Nov 14, 2024 · 0 comments

Comments

@hilmanski
Copy link
Contributor

hilmanski commented Nov 14, 2024

The developer team from a high-volume customer reached out that we should throw a proper error on the serpapi.search.

I've suggested using a try-catch exception to handle errors. For example:

try:
    search = serpapi.search(q="CoffeeMilk", api_key="", engine="google", location="Austin, Texas", hl="en", gl="us")
    print(search)
    print("----------------")
except Exception as e:
    if "429" in str(e):
        print("You are being rate limited")
        print(e)
    else:
        print("An error occurred")

Intercom

sidenote: we should probably update our readme to show how to handle errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant