note that:
1) I think you miss
2) I assume resp is string
try
1) I think you miss
]
on line 1082) I assume resp is string
try
resp = """{ "Reservations": [ { "Instances": [ { "Monitoring": { "State": "disabled" }, "PublicDnsName": "", "StateReason": { "Message": "Client.UserInitiatedShutdown: User initiated shutdown", "Code": "Client.UserInitiatedShutdown" }, "State": { "Code": 80, "Name": "stopped" }, "EbsOptimized": false, "LaunchTime": "2018-02-08T10:37:36.000Z", "PrivateIpAddress": "xx.xx.x.xxx", "ProductCodes": [], "VpcId": "xx-xxxx", "StateTransitionReason": "User initiated (2018-02-08 11:13:34 GMT)", "InstanceId": "xxxxxxxx", "EnaSupport": true, "ImageId": "xx-xxxxx", "PrivateDnsName": "xxxxxxx", "KeyName": "xxxxx", "SecurityGroups": [ { "GroupName": "xxxxxx", "GroupId": "xxxxxxx" } ], "ClientToken": "", "SubnetId": "xxxx-xxxx", "InstanceType": "t2.micro", "NetworkInterfaces": [ { "Status": "in-use", "MacAddress": "xxxxxxx", "SourceDestCheck": true, "VpcId": "xxxxx", "Description": "Primary network interface", "NetworkInterfaceId": "xxxx", "PrivateIpAddresses": [ { "PrivateDnsName": "xxxxxxx", "Primary": true, "PrivateIpAddress": "xx.xx.xx.xxx" } ], "PrivateDnsName": "xxxxxx", "Attachment": { "Status": "xxx", "DeviceIndex": 0, "DeleteOnTermination": true, "AttachmentId": "xxxxxx", "AttachTime": "2017-12-28T17:24:50.000Z" }, "Groups": [ { "GroupName": "xx", "GroupId": "xx-xxxx" } ], "Ipv6Addresses": [], "OwnerId": "xxxxxxx", "SubnetId": "subnet-xxxxx", "PrivateIpAddress": "xx.xx.x.x" } ], "SourceDestCheck": true, "Placement": { "Tenancy": "default", "GroupName": "", "AvailabilityZone": "xx-xx-xx" }, "Hypervisor": "xen", "BlockDeviceMappings": [ { "DeviceName": "/xx/xx", "Ebs": { "Status": "attached", "DeleteOnTermination": true, "VolumeId": "vol-xxxxxxxx", "AttachTime": "2017-12-28T17:24:51.000Z" } } ], "Architecture": "x86_64", "RootDeviceType": "ebs", "RootDeviceName": "/dev/xvda", "VirtualizationType": "hvm", "Tags": [ { "Value": "xxxx", "Key": "Name" } ], "AmiLaunchIndex": 0 } ], "ReservationId": "00000f4510a2551", "Groups": [], "OwnerId": "xxxxxxxx" } ] }""" import json slack_msg = json.loads(resp) slack_msg['channel'] = SLACK_CHANNEL slack_json = json.dumps(slack_msg) req = Request(HOOK_URL, slack_json)again better use requests, instead of urllib2