Ok, this is just a portion of a large program.
In [1]: event = {
...: "Records": [
...: {
...: "EventSource": "aws:sns",
...: "EventVersion": "1.0",
...: "EventSubscriptionArn": "arn:aws:sns:eu-XXX-1:XXXXX:aws_XXX",
...: "Sns": {
...: "Type": "Notification",
...: "MessageId": "95XXXXX-eXXX-5XXX-9XXX-4cXXXXXXX",
...: "TopicArn": "arn:aws:sns:us-XXX-1:XXXXXXX:EXXXXXTXXX",
...: "Subject": "example subject",
...: "Message": "example message",
...: "Timestamp": "1970-01-01T00:00:00.000Z",
...: "SignatureVersion": "1",
...: "Signature": "EXAMPLE",
...: "SigningCertUrl": "EXAMPLE",
...: "UnsubscribeUrl": "EXAMPLE",
...: "MessageAttributes": {
...: "Test": {"Type": "String", "Value": "TestString"},
...: "TestBinary": {"Type": "Binary", "Value": "TestBinary"},
...: },
...: },
...: }
...: ]
...: }
I am able to print single key value inside the nested dictionary Sns like this:
In [29]: event["Records"][0]["Sns"]["Subject"]
Out[29]: 'example subject'
But how to print multiple key values of it?.
The following way fails.
In [38]: event["Records"][0]["Sns"](["Timestamp"], ["Subject"], ["Message"])
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [38], in <module>
----> 1 event["Records"][0]["Sns"](["Timestamp"], ["Subject"], ["Message"])
TypeError: 'dict' object is not callable