Sanjayraju30 commited on
Commit
3dc7af0
·
verified ·
1 Parent(s): 08429da

Create salesforce_integration.py

Browse files
Files changed (1) hide show
  1. salesforce_integration.py +15 -0
salesforce_integration.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from simple_salesforce import Salesforce
2
+
3
+ # Salesforce Authentication
4
+ def authenticate_salesforce():
5
+ return Salesforce(username='your_username', password='your_password', security_token='your_security_token')
6
+
7
+ # Fetch data from Salesforce custom objects (Pole, Sensor Data, Alerts)
8
+ def fetch_salesforce_data():
9
+ sf = authenticate_salesforce()
10
+
11
+ # Fetching data from the 'Pole' custom object
12
+ poles_data = sf.query("SELECT Id, Name, Latitude__c, Longitude__c, Solar_Output__c, Wind_Output__c FROM Pole__c")
13
+
14
+ # Return the fetched records
15
+ return poles_data['records']