Azure の Cognitive Services で翻訳しようとしてエラーになったときやったこと text translation

エラー

response {'error': {'code': 401000, 'message': 'The request is not authorized because credentials are missing or invalid.'}}


Regionをリクエストヘッダーに追加する

    headers = {
    'Ocp-Apim-Subscription-Key': '0123456789abcdefghijk',  
    'Ocp-Apim-Subscription-Region': 'japaneast', # ← Region の指定
    'Content-type': 'application/json'
    }


OK

response [{'language': 'fr', 'score': 1.0, 'isTranslationSupported': True, 'isTransliterationSupported': False}]