gopichandra commited on
Commit
7d91e63
·
verified ·
1 Parent(s): b5ce9e8

Update salesforce_integration.py

Browse files
Files changed (1) hide show
  1. 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
- # Use OAuth credentials from the Connected App
5
- sf = Salesforce(client_id='YOUR_CONSUMER_KEY',
6
- client_secret='YOUR_CONSUMER_SECRET',
7
- username='YOUR_USERNAME',
8
- password='YOUR_PASSWORD',
9
- security_token='YOUR_SECURITY_TOKEN')
10
 
11
- # Fetch the Quote record (use the correct Quote record ID)
12
- 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'")
 
 
 
 
13
 
14
- # Handle possible error if Quote not found
15
- try:
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
- print(quote_data)
 
 
 
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