File size: 586 Bytes
3dc7af0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from simple_salesforce import Salesforce

# Salesforce Authentication
def authenticate_salesforce():
    return Salesforce(username='your_username', password='your_password', security_token='your_security_token')

# Fetch data from Salesforce custom objects (Pole, Sensor Data, Alerts)
def fetch_salesforce_data():
    sf = authenticate_salesforce()

    # Fetching data from the 'Pole' custom object
    poles_data = sf.query("SELECT Id, Name, Latitude__c, Longitude__c, Solar_Output__c, Wind_Output__c FROM Pole__c")

    # Return the fetched records
    return poles_data['records']