Advertisement
Guest User

Untitled

a guest
Jan 8th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. """
  2. This totally ignores OAuth2 and from the source code of the library,
  3. it's hitting v29 of the SFDC API which I have to assume allows direct
  4. connections like this. I've been away from Salesforce for 4 years now, but
  5. I'm sort of suprised credetials like this are still OK for org access
  6. """
  7.  
  8. import json
  9. import uuid
  10. from simple_salesforce import Salesforce
  11. sf = Salesforce(username={thing1},
  12. password={thing2},
  13. security_token={oooh a secret...in a script??})
  14.  
  15. record = sf.Contact.create({'LastName': str(uuid.uuid4()), 'Email': 'testing@foo.com'})
  16. print("Record created....here's proof:")
  17. print(record)
  18.  
  19. properties = list(record.items())
  20. id = properties[0][1]
  21. print("Dat Contact Id <<< {} >>>".format(id))
  22.  
  23. raw_record = sf.Contact.get(id)
  24. print("Raw SFDC data:")
  25. print(raw_record)
  26.  
  27. output = json.dumps(raw_record, indent=4, sort_keys=True)
  28. print("Finally, JSON output:")
  29. print(output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement