DSatishchandra commited on
Commit
37b24eb
·
verified ·
1 Parent(s): e0fd1d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
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:", customer_login)
73
  return customer_login
74
  except Exception as e:
75
- # Print the error to the console and log it for troubleshooting
76
- print(f"Error creating Salesforce record: {str(e)}")
77
- return {"error": f"Failed to create record in Salesforce: {str(e)}"}
 
 
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("/")