Skip to content

Commit

Permalink
Latest content moderator
Browse files Browse the repository at this point in the history
  • Loading branch information
lmazuel committed Dec 21, 2018
1 parent 46b4b17 commit dedefdc
Show file tree
Hide file tree
Showing 13 changed files with 1,042 additions and 1,032 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest.service_client import SDKClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from .operations.image_moderation_operations import ImageModerationOperations
Expand All @@ -27,55 +27,36 @@ class ContentModeratorClientConfiguration(Configuration):
Note that all parameters used to create this instance are saved as instance
attributes.
:param base_url_parameter: Supported Azure regions for Content Moderator
endpoints. Possible values include: 'westus.api.cognitive.microsoft.com',
'westus2.api.cognitive.microsoft.com',
'eastus.api.cognitive.microsoft.com',
'eastus2.api.cognitive.microsoft.com',
'westcentralus.api.cognitive.microsoft.com',
'southcentralus.api.cognitive.microsoft.com',
'westeurope.api.cognitive.microsoft.com',
'northeurope.api.cognitive.microsoft.com',
'southeastasia.api.cognitive.microsoft.com',
'eastasia.api.cognitive.microsoft.com',
'australiaeast.api.cognitive.microsoft.com',
'brazilsouth.api.cognitive.microsoft.com',
'contentmoderatortest.azure-api.net'
:type base_url_parameter: str or
~azure.cognitiveservices.vision.contentmoderator.models.AzureRegionBaseUrl
:param endpoint: Supported Cognitive Services endpoints (protocol and
hostname, for example: https://westus.api.cognitive.microsoft.com).
:type endpoint: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""

def __init__(
self, base_url_parameter, credentials):
self, endpoint, credentials):

if base_url_parameter is None:
raise ValueError("Parameter 'base_url_parameter' must not be None.")
if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
base_url = 'https://{baseUrl}'
base_url = '{Endpoint}'

super(ContentModeratorClientConfiguration, self).__init__(base_url)

self.add_user_agent('azure-cognitiveservices-vision-contentmoderator/{}'.format(VERSION))

self.base_url_parameter = base_url_parameter
self.endpoint = endpoint
self.credentials = credentials


class ContentModeratorClient(object):
class ContentModeratorClient(SDKClient):
"""You use the API to scan your content as it is generated. Content Moderator then processes your content and sends the results along with relevant information either back to your systems or to the built-in review tool. You can use this information to take decisions e.g. take it down, send to human judge, etc.
When using the API, images need to have a minimum of 128 pixels and a maximum file size of 4MB.
Text can be at most 1024 characters long.
If the content passed to the text API or the image API exceeds the size limits, the API will return an error code that informs about the issue.
This API is currently available in:
* West US - westus.api.cognitive.microsoft.com
* East US 2 - eastus2.api.cognitive.microsoft.com
* West Central US - westcentralus.api.cognitive.microsoft.com
* West Europe - westeurope.api.cognitive.microsoft.com
* Southeast Asia - southeastasia.api.cognitive.microsoft.com .
:ivar config: Configuration for client.
:vartype config: ContentModeratorClientConfiguration
Expand All @@ -95,32 +76,19 @@ class ContentModeratorClient(object):
:ivar reviews: Reviews operations
:vartype reviews: azure.cognitiveservices.vision.contentmoderator.operations.ReviewsOperations
:param base_url_parameter: Supported Azure regions for Content Moderator
endpoints. Possible values include: 'westus.api.cognitive.microsoft.com',
'westus2.api.cognitive.microsoft.com',
'eastus.api.cognitive.microsoft.com',
'eastus2.api.cognitive.microsoft.com',
'westcentralus.api.cognitive.microsoft.com',
'southcentralus.api.cognitive.microsoft.com',
'westeurope.api.cognitive.microsoft.com',
'northeurope.api.cognitive.microsoft.com',
'southeastasia.api.cognitive.microsoft.com',
'eastasia.api.cognitive.microsoft.com',
'australiaeast.api.cognitive.microsoft.com',
'brazilsouth.api.cognitive.microsoft.com',
'contentmoderatortest.azure-api.net'
:type base_url_parameter: str or
~azure.cognitiveservices.vision.contentmoderator.models.AzureRegionBaseUrl
:param endpoint: Supported Cognitive Services endpoints (protocol and
hostname, for example: https://westus.api.cognitive.microsoft.com).
:type endpoint: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""

def __init__(
self, base_url_parameter, credentials):
self, endpoint, credentials):

self.config = ContentModeratorClientConfiguration(base_url_parameter, credentials)
self._client = ServiceClient(self.config.credentials, self.config)
self.config = ContentModeratorClientConfiguration(endpoint, credentials)
super(ContentModeratorClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '1.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
from ._models_py3 import APIError
from ._models_py3 import Address
from ._models_py3 import Body
from ._models_py3 import BodyMetadata
from ._models_py3 import BodyModel
from ._models_py3 import Candidate
from ._models_py3 import Classification
from ._models_py3 import ClassificationCategory1
from ._models_py3 import ClassificationCategory2
from ._models_py3 import ClassificationCategory3
from ._models_py3 import Content
from ._models_py3 import CreateReviewBodyItem
from ._models_py3 import CreateReviewBodyItemMetadataItem
Expand All @@ -40,7 +42,6 @@
from ._models_py3 import ImageAdditionalInfoItem
from ._models_py3 import ImageIds
from ._models_py3 import ImageList
from ._models_py3 import ImageListMetadata
from ._models_py3 import Job
from ._models_py3 import JobExecutionReportDetails
from ._models_py3 import JobId
Expand All @@ -52,14 +53,12 @@
from ._models_py3 import PII
from ._models_py3 import Phone
from ._models_py3 import RefreshIndex
from ._models_py3 import RefreshIndexAdvancedInfoItem
from ._models_py3 import Review
from ._models_py3 import Score
from ._models_py3 import SSN
from ._models_py3 import Screen
from ._models_py3 import Status
from ._models_py3 import Tag
from ._models_py3 import TermList
from ._models_py3 import TermListMetadata
from ._models_py3 import Terms
from ._models_py3 import TermsData
from ._models_py3 import TermsInList
Expand All @@ -74,10 +73,12 @@
from ._models import APIError
from ._models import Address
from ._models import Body
from ._models import BodyMetadata
from ._models import BodyModel
from ._models import Candidate
from ._models import Classification
from ._models import ClassificationCategory1
from ._models import ClassificationCategory2
from ._models import ClassificationCategory3
from ._models import Content
from ._models import CreateReviewBodyItem
from ._models import CreateReviewBodyItemMetadataItem
Expand All @@ -100,7 +101,6 @@
from ._models import ImageAdditionalInfoItem
from ._models import ImageIds
from ._models import ImageList
from ._models import ImageListMetadata
from ._models import Job
from ._models import JobExecutionReportDetails
from ._models import JobId
Expand All @@ -112,14 +112,12 @@
from ._models import PII
from ._models import Phone
from ._models import RefreshIndex
from ._models import RefreshIndexAdvancedInfoItem
from ._models import Review
from ._models import Score
from ._models import SSN
from ._models import Screen
from ._models import Status
from ._models import Tag
from ._models import TermList
from ._models import TermListMetadata
from ._models import Terms
from ._models import TermsData
from ._models import TermsInList
Expand All @@ -130,17 +128,18 @@
from ._models import VideoFrameBodyItemMetadataItem
from ._models import VideoFrameBodyItemReviewerResultTagsItem
from ._models import APIErrorException
from ._content_moderator_client_enums import AzureRegionBaseUrl


__all__=[
'APIError',
'Address',
'Body',
'BodyMetadata',
'BodyModel',
'Candidate',
'Classification',
'ClassificationCategory1',
'ClassificationCategory2',
'ClassificationCategory3',
'Content',
'CreateReviewBodyItem',
'CreateReviewBodyItemMetadataItem',
Expand All @@ -163,7 +162,6 @@
'ImageAdditionalInfoItem',
'ImageIds',
'ImageList',
'ImageListMetadata',
'Job',
'JobExecutionReportDetails',
'JobId',
Expand All @@ -175,14 +173,12 @@
'PII',
'Phone',
'RefreshIndex',
'RefreshIndexAdvancedInfoItem',
'Review',
'Score',
'SSN',
'Screen',
'Status',
'Tag',
'TermList',
'TermListMetadata',
'Terms',
'TermsData',
'TermsInList',
Expand All @@ -193,5 +189,4 @@
'VideoFrameBodyItemMetadataItem',
'VideoFrameBodyItemReviewerResultTagsItem',
'APIErrorException',
'AzureRegionBaseUrl',
]

This file was deleted.

Loading

0 comments on commit dedefdc

Please sign in to comment.