import SQLForce from SQLForce import AttachmentWriter session = SQLForce.Session("MyConnectionParameters") salesforceParentId = '001A0000014fia3' # The unique id of the Salesforce object to own the attachment filename = "/mydir/salesforcecast.docx" # The file to add as an attachment. attachmentId = AttachmentWriter( session, salesforceParentId, filename )
The code that uploads the attachment is the last line -- The only tough part is determining the attachment parent. For a more realistic example that reads the attachment data to upload from a spreadsheet see this longer example.
There's nothing but good news with SQLForce/Python.