Skip to content

Commit ccb93d6

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 98c7f46 commit ccb93d6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

samples/vision/content_moderator_video_review.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
from azure.cognitiveservices.vision.contentmoderator.models import Frames
88
from msrest.authentication import CognitiveServicesCredentials
99

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

1513
def video_review(subscription_key):
1614
"""VideoReview.
@@ -32,7 +30,7 @@ def video_review(subscription_key):
3230
frame3_url = "https://blobthebuilder.blob.core.windows.net/sampleframes/ams-video-frame-3-02-24.PNG"
3331

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

@@ -125,4 +123,4 @@ def create_frames_to_add_to_reviews(timestamp_seconds, url):
125123
import os.path
126124
sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
127125
from tools import execute_samples
128-
execute_samples(globals(), SUBSCRIPTION_KEY_ENV_NAME)
126+
execute_samples(globals(), SUBSCRIPTION_KEY)

0 commit comments

Comments
 (0)