Spaces:
Runtime error
Runtime error
Update salesforce_integration.py
Browse files- salesforce_integration.py +17 -15
salesforce_integration.py
CHANGED
|
@@ -1,20 +1,22 @@
|
|
| 1 |
from simple_salesforce import Salesforce
|
| 2 |
-
from simple_salesforce.exceptions import SalesforceResourceNotFound
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
| 16 |
-
quote_data = sf.query("SELECT Customer_Name__c, Quote_Date__c, Origination_Location__c, Total_Amount__c FROM Quote__c WHERE Id = 'YOUR_QUOTE_ID'")
|
| 17 |
-
except SalesforceResourceNotFound:
|
| 18 |
-
print("Quote not found or incorrect ID!")
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
| 1 |
from simple_salesforce import Salesforce
|
|
|
|
| 2 |
|
| 3 |
+
# Salesforce credentials (Directly included in the code)
|
| 4 |
+
consumer_key = '3MVG9PwZx9R6_UrfAEK05VEm.bbDjlyPoEYQnaiFNTcDfa05aATw.cuifiB.xlmJ3WkGveCyJErK5tsrgq_DM'
|
| 5 |
+
consumer_secret = 'A4689ACC32DE07D94AD5511490C95FE63D98C30091170BA6ECF3286FF2AE44E0'
|
| 6 |
+
username = 'venkatramana@sandbox.com'
|
| 7 |
+
password = 'Seta12345@'
|
| 8 |
+
security_token = 'Drl0jchCwLBfvX4ODMeFDksP'
|
| 9 |
|
| 10 |
+
# Authenticate with Salesforce
|
| 11 |
+
sf = Salesforce(client_id=consumer_key,
|
| 12 |
+
client_secret=consumer_secret,
|
| 13 |
+
username=username,
|
| 14 |
+
password=password,
|
| 15 |
+
security_token=security_token)
|
| 16 |
|
| 17 |
+
# Fetch Quote data from Salesforce (replace 'YOUR_QUOTE_ID' with actual Quote ID)
|
| 18 |
+
quote_data = sf.query("SELECT Customer_Name__c, Quote_Date__c, Origination_Location__c, Total_Amount__c FROM Quote__c WHERE Id = 'YOUR_QUOTE_ID'")
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
# Return quote data
|
| 21 |
+
def get_quote_data():
|
| 22 |
+
return quote_data
|