Ajay98 commited on
Commit
7a24375
·
verified ·
1 Parent(s): 8850029

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -15
app.py CHANGED
@@ -1,26 +1,18 @@
1
  from simple_salesforce import Salesforce
2
 
3
- # Salesforce credentials
4
  username = 'ajayalways411@gmail.com'
5
- password = 'Anusha@310819'
6
- security_token = 'DcroeUKt0Lc4Lpqgzh9dMxEyQ'
7
  domain = 'login' # Use 'test' if using a sandbox
8
 
9
-
10
  username = username.strip()
11
  password = password.strip()
12
- security_token = security_token.strip()
13
-
14
-
15
- from simple_salesforce import Salesforce
16
-
17
- sf = Salesforce(username=username, password=password, security_token=security_token, domain=domain)
18
-
19
 
20
  # Connect to Salesforce
21
- sf = Salesforce(username=username, password=password, security_token=security_token, domain=domain)
22
 
23
- # Define your custom object API names (replace 'Custom_Object__c' with your actual custom object API names)
24
  custom_object_1 = 'staff__c'
25
  custom_object_2 = 'CustomerDat__c'
26
 
@@ -28,7 +20,7 @@ custom_object_2 = 'CustomerDat__c'
28
  records_custom_object_1 = sf.query(f"SELECT Name, AdhardCardPhoto__c, pancardPhoto__c, PhoneNumber__c FROM {custom_object_1}")
29
 
30
  # Retrieve records from the second custom object
31
- records_custom_object_2 = sf.query(f"SELECT name, AdhardCard__c,contactNumber__c, pancard__c FROM {custom_object_2}")
32
 
33
  # Print retrieved records
34
  print("Records from Custom Object 1:")
@@ -38,4 +30,3 @@ for record in records_custom_object_1['records']:
38
  print("\nRecords from Custom Object 2:")
39
  for record in records_custom_object_2['records']:
40
  print(record)
41
-
 
1
  from simple_salesforce import Salesforce
2
 
3
+ # Salesforce credentials (consider using environment variables in practice)
4
  username = 'ajayalways411@gmail.com'
5
+ password = 'Anusha@310819' + 'DcroeUKt0Lc4Lpqgzh9dMxEyQ' # Append security token to password
 
6
  domain = 'login' # Use 'test' if using a sandbox
7
 
8
+ # Strip extra whitespace (good practice, but likely not necessary here)
9
  username = username.strip()
10
  password = password.strip()
 
 
 
 
 
 
 
11
 
12
  # Connect to Salesforce
13
+ sf = Salesforce(username=username, password=password, domain=domain)
14
 
15
+ # Define your custom object API names (replace with your actual custom object API names)
16
  custom_object_1 = 'staff__c'
17
  custom_object_2 = 'CustomerDat__c'
18
 
 
20
  records_custom_object_1 = sf.query(f"SELECT Name, AdhardCardPhoto__c, pancardPhoto__c, PhoneNumber__c FROM {custom_object_1}")
21
 
22
  # Retrieve records from the second custom object
23
+ records_custom_object_2 = sf.query(f"SELECT name, AdhardCard__c, contactNumber__c, pancard__c FROM {custom_object_2}")
24
 
25
  # Print retrieved records
26
  print("Records from Custom Object 1:")
 
30
  print("\nRecords from Custom Object 2:")
31
  for record in records_custom_object_2['records']:
32
  print(record)