Exemple #1
0
from hmalib.lambdas.api.middleware import (
    jsoninator,
    JSONifiable,
    DictParseable,
    SubApp,
)
from hmalib.common.models.pipeline import MatchRecord, PipelineHashRecord
from hmalib.common.models.content import (
    ContentObject,
    ActionEvent,
    ContentRefType,
)
from hmalib.common.content_sources import S3BucketContentSource
from hmalib.common.logging import get_logger

logger = get_logger(__name__)
s3_client = boto3.client("s3")
dynamodb = boto3.resource("dynamodb")


@dataclass
class HashResultResponse(JSONifiable):
    content_id: str
    content_hash: str
    updated_at: str

    def to_json(self) -> t.Dict:
        return asdict(self)


@dataclass
Exemple #2
0
   ACTION RULE:
      Name: Comment On Workplace Matches
      Classification Conditions: 
         Dataset Source = te
         SubmittedContent has been classified = integration_source:workplace
      Action: WorkplaceCommentAction

   NOTE: 
   1. HMA will parse "<content-id>" and replace with the submitted
      content-id. This script stores uses WorkplacePostID as the 
      content-id.
   2. Replace WORKPLACE-ACCESS-TOKEN with the access token from your workplace bot
"""

logger = get_logger()

# Placeholder values
# You could optionally chose to deploy these as terraform variables
WORKPLACE_APP_SECRET = "1234567"
HMA_API_GATEWAY_URL = "https://xxxxxxxxx.execute-api.us-east-1.amazonaws.com"
HMA_API_TOKEN = "7654321"


@dataclass
class PhotoToUpload:
    photo_id: str
    photo_url: str
    additional_fields: t.List[str]