GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Using google.cloud.operation for GAPIC Speech async? · Issue #2629 · googleapis/google-cloud-python

Using google.cloud.operation for GAPIC Speech async? #2629

New issue
Copy link
New issue
Copy link
Closed
Closed
Using google.cloud.operation for GAPIC Speech async?#2629
Copy link
Assignees
tseaver
Labels
api: speechIssues related to the Speech-to-Text API.

Description

@daspecster
daspecster
opened on Oct 27, 2016
Issue body actions

I've been struggling today with the right way to implement this.
I can't seem to make_secure_stub for speech.

This is the error I get...

File "/Users/daspecster/Documents/google/google-cloud-py-2/.tox/py27/lib/python2.7/site-packages/google_cloud_speech-0.20.0.dev0-py2.7.egg/google/cloud/speech/_gax.py", line 92, in async_recognize
    OPERATIONS_API_HOST)
  File "/Users/daspecster/Documents/google/google-cloud-py-2/.tox/py27/lib/python2.7/site-packages/google_cloud_core-0.20.0-py2.7.egg/google/cloud/_helpers.py", line 642, in make_secure_stub
    transport_creds = grpc.ssl_channel_credentials()
AttributeError: 'module' object has no attribute 'ssl_channel_credentials'

Example code:

        config = RecognitionConfig(
            encoding=sample.encoding, sample_rate=sample.sample_rate,
            language_code=language_code, max_alternatives=max_alternatives,
            profanity_filter=profanity_filter,
            speech_context=SpeechContext(phrases=speech_context))

        audio = RecognitionAudio(content=sample.content,
                                 uri=sample.source_uri)
        self._client._operations_stub = make_secure_stub(
            self._client.connection.credentials,
            DEFAULT_USER_AGENT,
            operations_grpc.OperationsStub,
            OPERATIONS_API_HOST)

        api = self._gapic_api
        operation = api.sync_recognize(config=config, audio=audio)
        return Operation.from_pb(operation, self._client)

Looking at the sample example it seems like the channel creation is different than it is in our _helpers.make_secure_stub

Activity

  1. daspecster
    added
    api: speechIssues related to the Speech-to-Text API.
    on Oct 27, 2016
  2. daspecster
    assigned
    tseaver
    and
    dhermes
    on Oct 27, 2016
  3. daspecster commented on Oct 27, 2016

    @daspecster
    daspecster
    on Oct 27, 2016
    ContributorAuthor
    More actions

    This seems to work though.

    ╰─$ .tox/py27/bin/python
    Python 2.7.10 (default, Oct 23 2015, 19:19:21)
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import grpc
    >>> grpc.ssl_channel_credentials()
    <grpc.ChannelCredentials object at 0x109463950>

    @bjwatson could something be messing up the grpc namespace in

        'gapic-google-cloud-speech-v1beta1 >= 0.11.1, < 0.12.0',
        'grpc-google-cloud-speech-v1beta1 >= 0.11.1, < 0.12.0',
    

    Also, @bjwatson, is gapic-google-longrunning ok to use or is it not really production ready yet?

  4. dhermes commented on Oct 27, 2016

    @dhermes
    dhermes
    on Oct 27, 2016
    Contributor
    More actions

    @daspecster It seems like there is an old version of grpc? Also, you don't need make_secure_stub for Speech (not used in Pub/Sub or Logging).

    There is a "bug" in that we should pass credentials through, but you shouldn't worry about handling it to get Speech in.

  5. daspecster commented on Oct 27, 2016

    @daspecster
    daspecster
    on Oct 27, 2016
    ContributorAuthor
    More actions

    @dhermes, Pub/Sub and Logging, don't use Operations AFAICT.
    A channel has to be made in order to make the OperationStub.
    https://github.com/GoogleCloudPlatform/python-docs-samples/blob/2da1c09b056798dd54be7106010f9d5610952bef/speech/grpc/transcribe_async.py#L32-L51

    I could just do that but that's not very DRY since we have it in core._helpers right?

  6. daspecster commented on Oct 27, 2016

    @daspecster
    daspecster
    on Oct 27, 2016
    ContributorAuthor
    More actions

    Fixed with #2632.

  7. daspecster
    closed this as completedon Oct 27, 2016
  8. bjwatson commented on Oct 28, 2016

    @bjwatson
    bjwatson
    on Oct 28, 2016
    More actions

    @daspecster Yes, gapic-google-longrunning is okay to use, although I plan to merge it into the next release of google-gax (with the same path and module name).

    We are also designing a more convenient layer for you to use in the future that will sit on top of the gapic-google-longrunning code. I'll take a look at what you did for Speech, and want to discuss with you what pain points you had.

  9. daspecster commented on Oct 28, 2016

    @daspecster
    daspecster
    on Oct 28, 2016
    ContributorAuthor
    More actions

    Ok sure! Thanks @bjwatson!

  10. theacodes
    unassigned
    dhermes
    on Sep 28, 2018
  11. parthea
    added a commit that references this issue on Sep 22, 2023

    chore: move samples from python-docs-sample (#66)

    d3dcbbc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @tseaver
    tseaver

Labels

api: speechIssues related to the Speech-to-Text API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.