Skip to content

Commit 7b2e0eb

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 55fcfa2 commit 7b2e0eb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

samples/vision/content_moderator_image_review.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
from azure.cognitiveservices.vision.contentmoderator import ContentModeratorClient
66
from msrest.authentication import CognitiveServicesCredentials
77

8-
SUBSCRIPTION_KEY_ENV_NAME = "CONTENTMODERATOR_SUBSCRIPTION_KEY"
9-
CONTENTMODERATOR_LOCATION = os.environ.get(
10-
"CONTENTMODERATOR_LOCATION", "westcentralus")
11-
8+
# Add your Azure Content Moderator subscription key to your environment variables.
9+
SUBSCRIPTION_KEY = os.environ['CONTENT_MODERATOR_SUBSCRIPTION_KEY']
1210

1311
def image_review(subscription_key):
1412
"""ImageReview.
@@ -29,7 +27,7 @@ def image_review(subscription_key):
2927
call_back_endpoint = "https://requestb.in/qmsakwqm"
3028

3129
client = ContentModeratorClient(
32-
endpoint='https://'+CONTENTMODERATOR_LOCATION+'.api.cognitive.microsoft.com',
30+
endpoint=os.environ['CONTENT_MODERATOR_ENDPOINT'], # Add your Content Moderator endpoint to your environment variables.
3331
credentials=CognitiveServicesCredentials(subscription_key)
3432
)
3533

0 commit comments

Comments
 (0)