File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 7
7
# </imports>
8
8
9
9
# <initialVars>
10
- key = "<paste-your-text-analytics-key-here>"
11
- endpoint = "<paste-your-text-analytics-endpoint-here>"
10
+ key_var_name = 'TEXT_ANALYTICS_SUBSCRIPTION_KEY'
11
+ if not key_var_name in os .environ :
12
+ raise Exception ('Please set/export the environment variable: {}' .format (key_var_name ))
13
+ subscription_key = os .environ [key_var_name ]
14
+
15
+ endpoint_var_name = 'TEXT_ANALYTICS_ENDPOINT'
16
+ if not endpoint_var_name in os .environ :
17
+ raise Exception ('Please set/export the environment variable: {}' .format (endpoint_var_name ))
18
+ endpoint = os .environ [endpoint_var_name ]
12
19
# </initialVars>
13
20
14
21
# <authentication>
15
22
def authenticateClient ():
16
- credentials = CognitiveServicesCredentials (key )
23
+ credentials = CognitiveServicesCredentials (subscription_key )
17
24
text_analytics_client = TextAnalyticsClient (
18
25
endpoint = endpoint , credentials = credentials )
19
26
return text_analytics_client
You can’t perform that action at this time.
0 commit comments