-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Description
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.