Skip to content
This repository was archived by the owner on Mar 20, 2018. It is now read-only.
This repository was archived by the owner on Mar 20, 2018. It is now read-only.

Can't Override timeout with CallOptions #207

Description

@juansolana

I'm using Python to make a query to Google's Vision API to obtain labels from an image, but I'm not able to set a timeout in case I don't receive a response within a given time.

I'm using the following code based on Google's Documentation of CallOptions.

This is my code:

class GoogleQuery():

def __init__(self, VisionTools):
    self.client = vision.ImageAnnotatorClient()
    self.QueryOptions = google.gax.CallOptions(timeout=0.1)

... more init fields

def QueryImage(self, frame):
    image = types.Image(content=frame)

    # Make query to Google
    response = self.client.label_detection(image=image, options=self.QueryOptions)

I have tried passing directly the arguments into the call to Google without success, like this:

    def QueryImage(self, frame):

        # Convert frame to a type compatible with Google API
        image = types.Image(content=frame)

        # Make query to Google
        o1 = CallOptions(timeout = 0.1)
        response = self.client.label_detection(image=image, options=(o1))

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions