Example #1
0
def get_text_index(s3, image_uri):

    encoded_uri = quote_plus(image_uri)
    try:
        obj = aws.get_s3_object(s3, settings.INDEX_BUCKET, encoded_uri)
    except ClientError:
        logging.debug("Metadata not found in S3 for %s", image_uri)
        return None
    body = obj.get("Body").read()
    return json.loads(body)
Example #2
0
def get_source_metadata(s3, image_uri):

    encoded_uri = quote_plus(image_uri)
    try:
        obj = aws.get_s3_object(s3, settings.TEXT_METADATA_BUCKET, encoded_uri)
    except ClientError:
        logging.debug("Original metadata not found in S3 for %s", image_uri)
        return None
    body = obj.get("Body").read()
    return body
Example #3
0
def get_text_index(s3, image_uri):

    encoded_uri = quote_plus(image_uri)
    obj = aws.get_s3_object(s3, settings.INDEX_BUCKET, encoded_uri)
    body = obj.get("Body").read()
    return json.loads(body)