|
7 | 7 | # </imports> |
8 | 8 |
|
9 | 9 | # <initialVars> |
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] |
| 10 | +key = "<paste-your-text-analytics-key-here>" |
| 11 | +endpoint = "<paste-your-text-analytics-endpoint-here>" |
19 | 12 | # </initialVars> |
20 | 13 |
|
21 | 14 | # <authentication> |
22 | 15 | def authenticateClient(): |
23 | | - credentials = CognitiveServicesCredentials(subscription_key) |
| 16 | + credentials = CognitiveServicesCredentials(key) |
24 | 17 | text_analytics_client = TextAnalyticsClient( |
25 | 18 | endpoint=endpoint, credentials=credentials) |
26 | 19 | return text_analytics_client |
@@ -156,5 +149,5 @@ def entity_recognition(): |
156 | 149 |
|
157 | 150 | sys.path.append(os.path.abspath(os.path.join(__file__, "..", ".."))) |
158 | 151 | from tools import execute_samples |
159 | | - |
160 | | - execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME) |
| 152 | + key_env_name = "TEXTANALYTICS_SUBSCRIPTION_KEY" |
| 153 | + execute_samples(globals(), key_env_name) |
0 commit comments