Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -61,6 +61,10 @@ def is_silent_audio(audio_path):
|
|
61 |
# Salesforce connection details
|
62 |
sf = Salesforce(username='[email protected]', password='Sati@1020', security_token='sSSjyhInIsUohKpG8sHzty2q')
|
63 |
|
|
|
|
|
|
|
|
|
64 |
# Function to create Salesforce record
|
65 |
def create_salesforce_record(name, email, phone_number):
|
66 |
try:
|
@@ -69,12 +73,14 @@ def create_salesforce_record(name, email, phone_number):
|
|
69 |
'Email__c': email,
|
70 |
'Phone_Number__c': phone_number
|
71 |
})
|
72 |
-
print("Salesforce record created successfully:
|
73 |
return customer_login
|
74 |
except Exception as e:
|
75 |
-
#
|
76 |
-
|
77 |
-
|
|
|
|
|
78 |
|
79 |
|
80 |
@app.route("/")
|
|
|
61 |
# Salesforce connection details
|
62 |
sf = Salesforce(username='[email protected]', password='Sati@1020', security_token='sSSjyhInIsUohKpG8sHzty2q')
|
63 |
|
64 |
+
# Debugging - Confirming Salesforce connection
|
65 |
+
print("Connected to Salesforce, checking user info...")
|
66 |
+
print(sf.UserInfo) # This will give you the user info if the connection is successful
|
67 |
+
|
68 |
# Function to create Salesforce record
|
69 |
def create_salesforce_record(name, email, phone_number):
|
70 |
try:
|
|
|
73 |
'Email__c': email,
|
74 |
'Phone_Number__c': phone_number
|
75 |
})
|
76 |
+
print(f"Salesforce record created successfully with ID: {customer_login['id']}")
|
77 |
return customer_login
|
78 |
except Exception as e:
|
79 |
+
# Improved error handling to catch and print specific API errors
|
80 |
+
error_message = str(e)
|
81 |
+
print(f"Error creating Salesforce record: {error_message}")
|
82 |
+
return {"error": f"Failed to create record in Salesforce: {error_message}"}
|
83 |
+
|
84 |
|
85 |
|
86 |
@app.route("/")
|