python-docs-samples icon indicating copy to clipboard operation
python-docs-samples copied to clipboard

How to specify quotaUser upon Speech Streaming request

Open heroddaji opened this issue 10 years ago • 8 comments

Dear,

We have a requirement to limit per user usage of speech streaming recognition. We want to limit by user identity "quotaUser" param as specified here: https://support.google.com/cloud/answer/7035610?hl=en

So far I cannot find out how to do that from Cloud Speech API doc. Could you please help me providing a sample code in python? if it even better if you use speech_streaming.py example code.

heroddaji avatar Aug 24 '16 02:08 heroddaji

@heroddaji Please take a loot at https://cloud.google.com/speech/limits to use the API appropriately.

puneith avatar Aug 24 '16 17:08 puneith

@heroddaji it doesn't appear our grpc clients currently expose the ability to do userquota, or if they do, it's very non-obvious how to do so.

theacodes avatar Aug 24 '16 22:08 theacodes

@heroddaji there are several ways to limit it from your end (such as with redis).

theacodes avatar Aug 24 '16 22:08 theacodes

@heroddaji Support for the quotaUser is no longer available. If the request is authenticated, the user QPS limit applies to the actual user (Google user ID). Otherwise, client IP is used. Hope that helps.

puneith avatar Aug 25 '16 02:08 puneith

thank you, i have not yet fully understand the part "the user QPS limit applies to the actual user (Google user ID)".

In which situation this applies? because in our app, we will use our google_json_secret key (our id). and distribute the app to users:

  • Does this means if many users use the app, they are using our google_user_id ?
  • Or do we need to have user to do authentication, for example using "oauth" to obtain their id and use in the speech request?
  • And in which situation the client IP is used ? because it seems we always need to have some authentication before using speech api

Sorry for confusion, but I hope you all can help me.

heroddaji avatar Aug 25 '16 04:08 heroddaji

@heroddaji Can you please give me details and specifics about how you are using or intend to use the speech api and distribute it to your users? I do get a sense from your previous comment, but I don't want to assume. Thanks.

puneith avatar Aug 25 '16 19:08 puneith

@heroddaji you shouldn't distribute your service account private key to end users. Client applications can't keep secrets, and private keys are intended for server-to-server communication.

theacodes avatar Aug 25 '16 19:08 theacodes

@heroddaji Closing this due to no activity. Please, open another issue if you have further questions. Also, adding to what @jonparrott said you should architect your system such that your app talks to the service which behind the scenes invokes the Speech API using the service account.

puneith avatar Sep 16 '16 05:09 puneith