Skip to content

Instantly share code, notes, and snippets.

@matiasmedina5
matiasmedina5 / S3Connection.py
Last active August 8, 2017 17:47
Connect to AWS S3 from Python and get an object from a bucket
import boto3
# Connect to S3.
client = boto3.client(
's3',
aws_access_key_id=str(projectSettings["AWS_ACCESS_KEY_ID"]),
aws_secret_access_key=str(projectSettings["AWS_SECRET_ACCESS_KEY"]),
)
# Get the object file from the bucket.
obj = client.get_object(Bucket=str(projectSettings["S3_BUCKET_NAME"]), Key="Attachments/" + appFile["S3_File_Name__c"])
@matiasmedina5
matiasmedina5 / SalesforceConnection.py
Created August 8, 2017 15:54
Connect to Salesforce using Beatbox (Python library to use the SOAP API of Salesforce)
import beatbox
service = beatbox.PythonClient() # instantiate the object
service.serverUrl = str(projectSettings["SF_SERVER_URL"]) # login using your sf credentials
service.login(str(projectSettings["SF_ORG_USER"]), str(projectSettings["SF_ORG_PASSWORD"]))
from Measure import Measure
__author__ = "Matias Medina"
__date__ = "$08/07/2016 03:55:35 PM$"
if __name__ == "__main__":
print "Processing..."
measure = Measure()
measure.runScript()
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
import beatbox
import xml.etree.ElementTree as ET
import traceback
import json
__author__ = "Matias Medina"