Skip to content

Commit 0aed91f

Browse files
author
Aaron Hill
committed
removing env variables
1 parent 43ddef9 commit 0aed91f

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

samples/language/text_analytics_samples.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,13 @@
77
# </imports>
88

99
# <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>"
1912
# </initialVars>
2013

2114
# <authentication>
2215
def authenticateClient():
23-
credentials = CognitiveServicesCredentials(subscription_key)
16+
credentials = CognitiveServicesCredentials(key)
2417
text_analytics_client = TextAnalyticsClient(
2518
endpoint=endpoint, credentials=credentials)
2619
return text_analytics_client
@@ -157,4 +150,4 @@ def entity_recognition():
157150
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
158151
from tools import execute_samples
159152

160-
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)
153+
execute_samples(globals(), key)

0 commit comments

Comments
 (0)