Skip to content
This repository was archived by the owner on Oct 19, 2023. It is now read-only.

Commit 29d53b1

Browse files
Google Assistant SDK Teamproppy
Google Assistant SDK Team
authored andcommitted
google-assistant-library: sync sample changes
- Add --nickname flag - Add --query flag to sample GitOrigin-RevId: bb0b4d3e90417058209191e332a64e33700f610c Change-Id: I6446e3f1ba2c3a1c2727ea7a85e2ea8195de8e87 Bug: 111445362
1 parent d05f675 commit 29d53b1

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

google-assistant-library/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Authorization
3939
- Generate credentials using ``google-oauth-tool``.::
4040

4141
pip install --upgrade google-auth-oauthlib[tool]
42-
google-oauthlib-tool --client-secrets path/to/client_secret_<client-id>.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --scope https://www.googleapis.com/auth/gcm --save --headless
42+
google-oauthlib-tool --client-secrets path/to/client_secret_XXXXX.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --scope https://www.googleapis.com/auth/gcm --save --headless
4343

4444
Usage
4545
-----

google-assistant-sdk/googlesamples/assistant/library/hotword.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ def main():
7575
parser.add_argument('--project-id', '--project_id', type=str,
7676
metavar='PROJECT_ID', required=False,
7777
help='the project ID used to register this device')
78+
parser.add_argument('--nickname', type=str,
79+
metavar='NICKNAME', required=False,
80+
help='the nickname used to register this device')
7881
parser.add_argument('--device-config', type=str,
7982
metavar='DEVICE_CONFIG_FILE',
8083
default=os.path.join(
@@ -91,6 +94,9 @@ def main():
9194
'credentials.json'
9295
),
9396
help='path to store and read OAuth2 credentials')
97+
parser.add_argument('--query', type=str,
98+
metavar='QUERY',
99+
help='query to send as soon as the Assistant starts')
94100
parser.add_argument('-v', '--version', action='version',
95101
version='%(prog)s ' + Assistant.__version_str__())
96102

@@ -130,7 +136,7 @@ def main():
130136
if should_register or (device_id != last_device_id):
131137
if args.project_id:
132138
register_device(args.project_id, credentials,
133-
device_model_id, device_id)
139+
device_model_id, device_id, args.nickname)
134140
pathlib.Path(os.path.dirname(args.device_config)).mkdir(
135141
exist_ok=True)
136142
with open(args.device_config, 'w') as f:
@@ -142,6 +148,9 @@ def main():
142148
print(WARNING_NOT_REGISTERED)
143149

144150
for event in events:
151+
if event.type == EventType.ON_START_FINISHED and args.query:
152+
assistant.send_text_query(args.query)
153+
145154
process_event(event)
146155

147156

0 commit comments

Comments
 (0)