Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,11 +6,13 @@ import numpy as np
|
|
| 6 |
from simple_salesforce import Salesforce
|
| 7 |
import time
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
# Test Salesforce connection
|
| 10 |
try:
|
| 11 |
-
sf = Salesforce(username='prashanth@safetyanaluzer.com', password='SaiPrash461', security_token='MOA3BXBfGyqnjBneog8a9IcGw')
|
| 12 |
# Simple query to verify the connection
|
| 13 |
-
result = sf.query("SELECT Id FROM
|
| 14 |
print("✅ Salesforce connection successful.")
|
| 15 |
except Exception as e:
|
| 16 |
print(f"❌ Error connecting to Salesforce: {e}")
|
|
@@ -173,7 +175,7 @@ def send_to_salesforce(violations, score, video_path):
|
|
| 173 |
|
| 174 |
try:
|
| 175 |
print(f"Creating Salesforce record with data: {data}") # Log data being sent to Salesforce
|
| 176 |
-
result = sf.
|
| 177 |
print(f"✅ Successfully created new report in Salesforce with ID: {result['id']}")
|
| 178 |
except Exception as e:
|
| 179 |
print(f"❌ Error creating/updating record in Salesforce: {e}")
|
|
|
|
| 6 |
from simple_salesforce import Salesforce
|
| 7 |
import time
|
| 8 |
|
| 9 |
+
# Salesforce connection details (replace these with your actual credentials)
|
| 10 |
+
sf = Salesforce(username='prashanth@safetyanaluzer.com', password='SaiPrash461', security_token='MOA3BXBfGyqnjBneog8a9IcGw')
|
| 11 |
+
|
| 12 |
# Test Salesforce connection
|
| 13 |
try:
|
|
|
|
| 14 |
# Simple query to verify the connection
|
| 15 |
+
result = sf.query("SELECT Id FROM Safety_Video_Report__c LIMIT 1")
|
| 16 |
print("✅ Salesforce connection successful.")
|
| 17 |
except Exception as e:
|
| 18 |
print(f"❌ Error connecting to Salesforce: {e}")
|
|
|
|
| 175 |
|
| 176 |
try:
|
| 177 |
print(f"Creating Salesforce record with data: {data}") # Log data being sent to Salesforce
|
| 178 |
+
result = sf.Safety_Video_Report__c.create(data) # Changed the object name to Safety_Video_Report__c
|
| 179 |
print(f"✅ Successfully created new report in Salesforce with ID: {result['id']}")
|
| 180 |
except Exception as e:
|
| 181 |
print(f"❌ Error creating/updating record in Salesforce: {e}")
|