X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=google_assistant.py;h=b767df75f4a56f4b4ec84be3abedd16b2e8a591b;hb=532df2c5b57c7517dfb3dddd8c1358fbadf8baf3;hp=4a3a58f5947ab335e26ac2fa1c7ce22afd841a93;hpb=e8fbbb7306430478dec55d2c963eed116d8330cc;p=python_utils.git diff --git a/google_assistant.py b/google_assistant.py index 4a3a58f..b767df7 100644 --- a/google_assistant.py +++ b/google_assistant.py @@ -1,11 +1,16 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A module to serve as a local client library around HTTP calls to -the Google Assistant via a local gateway.""" +the Google Assistant via a local gateway. + +""" import logging import warnings -from typing import NamedTuple, Optional +from dataclasses import dataclass +from typing import Optional import requests import speech_recognition as sr # type: ignore @@ -34,13 +39,14 @@ parser.add_argument( ) -class GoogleResponse(NamedTuple): +@dataclass +class GoogleResponse: """A response wrapper.""" - success: bool - response: str - audio_url: str - audio_transcription: Optional[str] # None if not available. + success: bool = False + response: str = '' + audio_url: str = '' + audio_transcription: Optional[str] = None # None if not available. def __repr__(self): return f"""