File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 77# You may need to install requests and uuid.
88# Run: pip install requests uuid
99
10-
1110import os , requests , uuid , json
1211
12+ endpoint_var_name = 'TRANSLATOR_TEXT_ENDPOINT'
13+ if not endpoint_var_name in os .environ :
14+ raise Exception ('Please set/export the environment variable: {}' .format (endpoint_var_name ))
15+ endpoint = os .environ [endpoint_var_name ]
16+
1317# If you encounter any issues with the base_url or path, make sure
1418# that you are using the latest endpoint: https://docs.microsoft.com/azure/cognitive-services/translator/reference/v3-0-languages
15- base_url = 'https://api.cognitive.microsofttranslator.com'
1619path = '/languages?api-version=3.0'
17- constructed_url = base_url + path
20+ constructed_url = endpoint + path
1821
1922headers = {
2023 'Content-type' : 'application/json' ,
You can’t perform that action at this time.
0 commit comments