Skip to content

Commit c429ac5

Browse files
authored
Updated key/endpoint
Endpoints are not region-based anymore, but rather custom domain -based. Although regional endpoints will still work. Also, the authentication information is moving to a standard of getting it from environment variables.
1 parent 7b2e0eb commit c429ac5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

samples/vision/content_moderator_term_list_samples.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
)
1313
from msrest.authentication import CognitiveServicesCredentials
1414

15-
SUBSCRIPTION_KEY_ENV_NAME = "CONTENTMODERATOR_SUBSCRIPTION_KEY"
16-
CONTENTMODERATOR_LOCATION = os.environ.get(
17-
"CONTENTMODERATOR_LOCATION", "westcentralus")
15+
# Add your Azure Content Moderator subscription key to your environment variables.
16+
SUBSCRIPTION_KEY = os.environ['CONTENT_MODERATOR_SUBSCRIPTION_KEY']
17+
1818
TEXT_FOLDER = os.path.join(os.path.dirname(
1919
os.path.realpath(__file__)), "text_files")
2020

@@ -30,7 +30,7 @@ def terms_lists(subscription_key):
3030
"""
3131

3232
client = ContentModeratorClient(
33-
endpoint='https://'+CONTENTMODERATOR_LOCATION+'.api.cognitive.microsoft.com',
33+
endpoint=os.environ['CONTENT_MODERATOR_ENDPOINT'], # Add your Content Moderator endpoint to your environment variables.
3434
credentials=CognitiveServicesCredentials(subscription_key)
3535
)
3636

@@ -181,4 +181,4 @@ def terms_lists(subscription_key):
181181
import os.path
182182
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
183183
from tools import execute_samples
184-
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)
184+
execute_samples(globals(), SUBSCRIPTION_KEY)

0 commit comments

Comments
 (0)