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

Fix a bug that shows "KeyError 'items'" #1118

Merged
merged 1 commit into from
Feb 17, 2023

Conversation

yakigac
Copy link
Contributor

@yakigac yakigac commented Feb 17, 2023

Fix KeyError 'items' when no result found.

Problem

When no result found for a query, google search crashed with KeyError 'items'.

Solution

I added a check for an empty response before accessing the 'items' key. It will handle the case correctly.

Other

my twitter: yakigac
(I don't mind even if you don't mention me for this PR. But just because last time my real name was shout out :) )

Copy link
Contributor

@hwchase17 hwchase17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@hwchase17 hwchase17 merged commit 1ed7083 into langchain-ai:master Feb 17, 2023
@yakigac yakigac deleted the fix/find_no_google_result branch February 21, 2023 09:57
@blob42 blob42 mentioned this pull request Feb 21, 2023
zachschillaci27 pushed a commit to zachschillaci27/langchain that referenced this pull request Mar 8, 2023
Fix KeyError 'items' when no result found.

## Problem

When no result found for a query, google search crashed with `KeyError
'items'`.

## Solution

I added a check for an empty response before accessing the 'items' key.
It will handle the case correctly.

## Other

my twitter: yakigac
(I don't mind even if you don't mention me for this PR. But just because
last time my real name was shout out :) )
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

Successfully merging this pull request may close these issues.

2 participants