Skip to content

Handling missing 'people' key and error messages in API response - #556

Open
MattSilverio wants to merge 1 commit into
mxrch:masterfrom
MattSilverio:master
Open

Handling missing 'people' key and error messages in API response#556
MattSilverio wants to merge 1 commit into
mxrch:masterfrom
MattSilverio:master

Conversation

@MattSilverio

Copy link
Copy Markdown

Scenario:

ghunt email example@gmail.com

...

peoplepa.py", line 120, in people_lookup
person_data = list(data["people"].values())[0]
~~~~^^^^^^^^^^
KeyError: 'people'

Now:
[-] Request Error: {messages}

@munzzyy

munzzyy commented Aug 1, 2026

Copy link
Copy Markdown

Every other API wrapper in the repo guards this. drive.py checks if "error" in data in all three of its methods, and clientauthconfig, identitytoolkit, geolocation, calendar and mobilesdk do the same. peoplepa's two methods have none, so this closes a real gap.

people() at line 206 on your branch, 199 on master, parses data["personResponse"][0]["status"] with no guard above it. So ghunt gaia still dies with KeyError: 'personResponse' on the same body Nem0oo posted in #513. Would you extend the check there too?

Two smaller things: import pprint on line 12 is unused, and the fallback string "Erro desconhecido." is Portuguese.

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