mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(skills): handle missing fields in Google Workspace token file gracefully instead of crashing with KeyError
This commit is contained in:
parent
8bc9b5a0b4
commit
dedc4600dd
1 changed files with 7 additions and 0 deletions
|
|
@ -25,6 +25,13 @@ def refresh_token(token_data: dict) -> dict:
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
|
required_keys = ["client_id", "client_secret", "refresh_token", "token_uri"]
|
||||||
|
missing = [k for k in required_keys if k not in token_data]
|
||||||
|
if missing:
|
||||||
|
print(f"ERROR: google_token.json is missing required fields: {', '.join(missing)}", file=sys.stderr)
|
||||||
|
print("Please re-authenticate by running the Google Workspace setup script.", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
params = urllib.parse.urlencode({
|
params = urllib.parse.urlencode({
|
||||||
"client_id": token_data["client_id"],
|
"client_id": token_data["client_id"],
|
||||||
"client_secret": token_data["client_secret"],
|
"client_secret": token_data["client_secret"],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue