Spaces:
Sleeping
Sleeping
| from simple_salesforce import Salesforce | |
| # Salesforce Authentication | |
| def authenticate_salesforce(): | |
| return Salesforce(username='greenenergy@vedavathi.com', password='Vedavathi@04', security_token='jqe4His8AcuFJucZz5NBHfGU') | |
| # 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'] | |