Since this thing is on the innerwebs I suppose it should have a
[python_utils.git] / google_assistant.py
index 4a3a58f5947ab335e26ac2fa1c7ce22afd841a93..b767df75f4a56f4b4ec84be3abedd16b2e8a591b 100644 (file)
@@ -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"""