@@ -0,0 +1,1937 @@
+# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A# This file is licensed under the Apache License, Version 2.0 (the %22License%22).%0A# You may not use this file except in compliance with the License. A copy of%0A# the License is located at%0A# %0A# http://aws.amazon.com/apache2.0/%0A# %0A# This file is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR%0A# CONDITIONS OF ANY KIND, either express or implied. See the License for the%0A# specific language governing permissions and limitations under the License.%0A%0A# snippet-sourcedescription:%5Badd_attachments_to_case.py demonstrates how to use AWS Support API to add attachments to an existing support case.%5D%0A# snippet-service:%5Bsupport%5D%0A# snippet-keyword:%5BPython%5D%0A# snippet-keyword:%5BAWS Support%5D%0A# snippet-keyword:%5BCode Sample%5D%0A# snippet-keyword:%5BAddAttachmentsToSet%5D%0A# snippet-keyword:%5BAddCommunicationToCase%5D%0A# snippet-sourcetype:%5Bfull-example%5D%0A# snippet-sourcedate:%5B2019-03-21%5D%0A# snippet-sourceauthor:%5Bwalkerk1980%5D%0A# snippet-start:%5Bsupport.python.add_attachments_to_case.complete%5D%0A%0Aimport boto3%0A%0A# your support case id%0Acase_id='case-123456789012-muen-2019-e23abb614ab25793'%0A%0A# file name to attach to support case%0Afile_name=%22test.jpg%22%0A%0A# body of communication to add to case%0Acommunication_body = 'add attachment test'%0A%0Asupport = boto3.client('support', region_name = 'us-east-1')%0A%0Awith open(file_name, mode='rb') as file:%0A    file_data = file.read()%0A%0Aattachment1 = %7B 'fileName' : file_name ,'data' : file_data %7D%0A%0Aattachment_set = support.add_attachments_to_set(%0A    attachments=%5B%0A        attachment1,%0A    %5D%0A) %0A%0Aadd_communication_response = support.add_communication_to_case(%0A    caseId = case_id,%0A    communicationBody = communication_body,%0A    attachmentSetId = attachment_set%5B'attachmentSetId'%5D,%0A)%0A%0Aif add_communication_response%5B'result'%5D:%0A    print('Communication with attachment successfully added.')%0A%0A# snippet-end:%5Bsupport.python.add_attachments_to_case.complete%5D%0A

Add Python add_attachments_to_case example for AWS Support