from dotenv import load_dotenv load_dotenv() from src.index import handler if __name__ == '__main__': event = { 'status': 'Success', 'context': { "correlation_id": "59d10831-dc55-44f3-b637-cc31086e5d04", "grps_ingestion_id": 1, "project": { "name": "DDG LP3", "project_code": "1536914", "artist": { "name": "DDG", "spotify_uri": "spotify:artist:0WK3H9OErSn5zKOkOV5egm", "apple_id": "3954994", } }, "product": { "upc": "196871691208", "product_name": "She Don't Play", "grid": "A10301A0005204073I", "display_artists": [ { "name": "DDG", "spotify_uri": "spotify:artist:0WK3H9OErSn5zKOkOV5egm", "apple_id": "3954994", "roles": [ "PRIMARY_ARTIST" ] } ], "vendor_id": 34519, "subaccount_id": 61173, "not_for_distribution": "SMEAnalyticsDummy", "parent_repertoire_owner_code": "C284", "repertoire_owner_code": "D670" }, "tracks": [ { "isrc": "USSM12308808", "track_name": "Lipgloss", "sequence_number": 2, "volume": 1, "explicit": "N", "display_artists": [] }, { "isrc": "USSM12308807", "track_name": "She Don't Play", "sequence_number": 1, "volume": 1, "explicit": "Y", "display_artists": [ { "name": "DDG", "spotify_uri": "spotify:artist:0WK3H9OErSn5zKOkOV5egm", "apple_id": "3954994", "roles": [ "PRIMARY_ARTIST" ] } ] } ], "label_participants": [ { "name": "DDG", "artist_id": "2396954", "label_participant_id": "4c982ee5-ee8d-4480-a4f8-03f6d6217253", "label_participant_uuid": "4c982ee5-ee8d-4480-a4f8-03f6d6217253" } ] } } error_event = { 'status': 'Failed', 'context': { "detail": { "requestParameters": { "upc": "196874264003", "grps_ingestion_id": 251 } }, "errors": { "Error": "RepOwnerDoNotIngestException", "Cause": "{\"errorMessage\": \"Provided rep owner (K592, K592) is marked as do not ingest in mapping table; Cannot proceed with ingestion.\", \"errorType\": \"RepOwnerDoNotIngestException\", \"requestId\": \"1063c509-ca25-4994-be71-a6ea85f20e41\", \"stackTrace\": [\" File \\\"/var/task/src/index.py\\\", line 33, in handler\\n product = get_product(upc)\\n\", \" File \\\"/var/task/src/index.py\\\", line 118, in get_product\\n raise RepOwnerDoNotIngestException(\\n\"]}" } } } res = handler(event, None) print(res)