C# Google Vision API - calling DetectText via proxy service

Viewed 11

I want to be able to call the API via a proxy service, but not sure which setting/settings need to be set. Is it a parameter in the ImageAnnotatorClientBuilder? Or in the ImageAnnotatorClient? Here is my code:

        var imageAnnotatorClientBuilder = new ImageAnnotatorClientBuilder();
        if (!string.IsNullOrEmpty(serviceEndpoint)) 
        {
            imageAnnotatorClientBuilder.Endpoint = serviceEndpoint;
        }
        if (!string.IsNullOrEmpty(credentialsPath)) 
        {
            imageAnnotatorClientBuilder.CredentialsPath = credentialsPath;
        }

        Image image = Image.FromFile("D:\\test.jpg");

        ImageAnnotatorClient = imageAnnotatorClientBuilder.Build();

        ImageAnnotatorClient.DetectText(image);
        

I have tried setting programmaticaly the environment variable https_proxy via Environment.SetEnvironmentVariable("https_proxy", "https://XX.XX.XXX.XX:3128"); with the correct endpoint where my proxy service is running, but it seems that the request never goes via this endpoint but instead directly to google.

0 Answers
Related