BotBuilder-Samples icon indicating copy to clipboard operation
BotBuilder-Samples copied to clipboard

Adding subscription region in Microsoft text translator api

Open Sumit-nainani opened this issue 1 year ago • 1 comments

Use this query to search for the most popular feature requests.

Is your feature request related to a problem? Please describe. I'm always frustrated when I use the Text Translator API sample code provided in the bot-builder-samples repository because the subscriptionRegion is not included in the header section. This omission leads to authentication errors when using a regional translator resource.

Description of the solution I would like the sample code to be updated to include the subscriptionRegion in the headers. The updated code should look like this: path of file is : microsoft/BotBuilder-Samples/samples/python/17.multilingual-bot/translation/microsoft_translator.py headers = { "Ocp-Apim-Subscription-Key": self.subscription_key, "Ocp-Apim-Subscription-Region": self.subscription_region, # Necessary if using a regional translator resource and If you are using a global translator resource, you can omit the 'Ocp-Apim-Subscription-Region' header. "Content-type": "application/json", "X-ClientTraceId": str(uuid.uuid4()),

}

Additionally, comments should be added to explain that this header is necessary when using a regional translator resource and can be omitted if using a global translator resource. For example:

alternatives I've considered As an alternative, I considered manually adding the subscriptionRegion every time I use the sample code. However, this is not an ideal solution as it requires extra effort and increases the likelihood of errors.

Additional context if not using region. Screenshot 2024-07-09 at 10 47 02 PM

if using region. Screenshot 2024-07-09 at 10 48 19 PM

Sumit-nainani avatar Jul 09 '24 17:07 Sumit-nainani

@Sumit-nainani .. any updates on this? We're having the same issue.

derhallim avatar Jul 28 '24 18:07 derhallim