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

Can't Override timeout with CallOptions #207

Open
juansolana opened this issue Nov 18, 2017 · 0 comments
Open

Can't Override timeout with CallOptions #207

juansolana opened this issue Nov 18, 2017 · 0 comments

Comments

@juansolana
Copy link

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))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant