Skip to content

Commit 55fcfa2

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 0a3898c commit 55fcfa2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

samples/vision/content_moderator_image_moderation_samples.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
)
1010
from msrest.authentication import CognitiveServicesCredentials
1111

12-
SUBSCRIPTION_KEY_ENV_NAME = "CONTENTMODERATOR_SUBSCRIPTION_KEY"
13-
CONTENTMODERATOR_LOCATION = os.environ.get(
14-
"CONTENTMODERATOR_LOCATION", "westcentralus")
12+
# Add your Azure Content Moderator subscription key to your environment variables.
13+
SUBSCRIPTION_KEY = os.environ['CONTENT_MODERATOR_SUBSCRIPTION_KEY']
1514

1615
IMAGE_LIST = [
1716
"https://moderatorsampleimages.blob.core.windows.net/samples/sample2.jpg",
@@ -26,7 +25,7 @@ def image_moderation(subscription_key):
2625
"""
2726

2827
client = ContentModeratorClient(
29-
endpoint='https://'+CONTENTMODERATOR_LOCATION+'.api.cognitive.microsoft.com',
28+
endpoint=os.environ['CONTENT_MODERATOR_ENDPOINT'], # Add your Content Moderator endpoint to your environment variables.
3029
credentials=CognitiveServicesCredentials(subscription_key)
3130
)
3231

0 commit comments

Comments
 (0)