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

Exception not handled on SerpApiClient.get_json #43

Open
danielperezefremova-tomtom opened this issue Apr 12, 2023 · 1 comment
Open

Comments

@danielperezefremova-tomtom

I am experiencing unexpected behaviors when getting thousands of queries. For some reason, sometimes the API returns an empty response. It happens at random (1 time out of 10000 perhaps).

When this situation happens, the method SerpApiClient.get_json does not handle the empty response. In consecuence, the json.loads() raises an exception causing a JSONDecodeError.

I attach an image to clarify the issue.

issue

It seems a problem with the API service. Not sure if the problem should be solved with an Exception handling, handling the code 204 (empty response), or if there is any bug with servers.

to reproduce the exception:

import json json.loads('')
Do you recommend any guidelines to handle the problem in the meanwhile you review the issue on the source code?

Thanks.

@ilyazub
Copy link
Contributor

ilyazub commented Apr 13, 2023

Thanks for raising this question.

Please share an extra information so we can investigate this issue:

  • A search ID of your successful searches
  • Search parameters which result into getting an empty response from serpapi.com

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

2 participants