Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,28 @@ import requests
|
|
| 3 |
import gradio as gr
|
| 4 |
import logging
|
| 5 |
from uuid import uuid4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Configure logging
|
| 8 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
import logging
|
| 5 |
from uuid import uuid4
|
| 6 |
+
from simple_salesforce import Salesforce
|
| 7 |
+
|
| 8 |
+
SALESFORCE_USERNAME = "vaneshdevarapalli866@agentforce.com"
|
| 9 |
+
SALESFORCE_PASSWORD = "vanesh@331"
|
| 10 |
+
SALESFORCE_SECURITY_TOKEN = "VRUVbBOdG0s9Q4xy0W6DB1Y6b"
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def connect_to_salesforce():
|
| 14 |
+
try:
|
| 15 |
+
sf_instance = Salesforce(
|
| 16 |
+
username=SALESFORCE_USERNAME,
|
| 17 |
+
password=SALESFORCE_PASSWORD,
|
| 18 |
+
security_token=SALESFORCE_SECURITY_TOKEN,
|
| 19 |
+
domain="login"
|
| 20 |
+
)
|
| 21 |
+
logger.info("Connected to Salesforce successfully.")
|
| 22 |
+
return sf_instance
|
| 23 |
+
except Exception as e:
|
| 24 |
+
logger.error(f"Salesforce connection failed: {e}")
|
| 25 |
+
raise
|
| 26 |
+
|
| 27 |
+
sf = connect_to_salesforce()
|
| 28 |
|
| 29 |
# Configure logging
|
| 30 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|