Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Add scope parameter for Cloud Speech #549

Open
wants to merge 1 commit into
base: aiyprojects
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/aiy/cloudspeech.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
AUDIO_FORMAT=AudioFormat(sample_rate_hz=AUDIO_SAMPLE_RATE_HZ,
num_channels=1,
bytes_per_sample=2)
_CLOUD_SPEECH_OAUTH_SCOPE = (
'https://www.googleapis.com/auth/cloud-platform'
)



logger = logging.getLogger(__name__)

Expand All @@ -47,7 +52,7 @@ def __init__(self, service_accout_file=None):
if service_accout_file is None:
service_accout_file = os.path.expanduser('~/cloud_speech.json')

credentials = service_account.Credentials.from_service_account_file(service_accout_file)
credentials = service_account.Credentials.from_service_account_file(service_accout_file, scopes=[_CLOUD_SPEECH_OAUTH_SCOPE])
self._client = speech.SpeechClient(credentials=credentials)

def _make_config(self, language_code, hint_phrases):
Expand Down