How to upload file attachments to Salesforce with Python
The are two ways of accessing the Salesforce API via Simple Object Access
(SOAP) and REspresentational State Transfer (REST). To programmatically
upload files or attachments to Salesforce using Python we evaluate first
how to do it using REST.
Looking at these docs Insert or Update Blob Data
uploading via REST is only possible if your organization is in the
Salesforce pilot program. For now we will implement the upload via SOAP
and using a Python library to access Salesforce named Beatbox .
Below is a command line script I coded to allow one to upload file to
Salesforce. For local testing I set the parentId of the upload file to an
Account named Ron Local or set with other value appropriately,
in production you would normally set the uploaded file to an Email id.
See also file upload limitations set by Salesforce. After successful
upload you can verify the uploaded file by going to the profile page of the
Account Ron Local or whatever name of the Account you used.