lokesh341 commited on
Commit
3009a94
·
verified ·
1 Parent(s): 6b27bf5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import torch
2
- from flask import Flask, render_template, request, jsonify, session
3
  import json
4
  import os
5
  from transformers import pipeline
@@ -26,7 +26,6 @@ try:
26
  print("Attempting to connect to Salesforce...")
27
  sf = Salesforce(username='diggavalli98@gmail.com', password='Sati@1020', security_token='sSSjyhInIsUohKpG8sHzty2q')
28
  print("Connected to Salesforce successfully!")
29
- print("User Info:", sf.UserInfo) # Log the user info to verify the connection
30
  except Exception as e:
31
  print(f"Failed to connect to Salesforce: {str(e)}")
32
 
@@ -93,7 +92,7 @@ def register():
93
  phone = data.get('phone')
94
 
95
  # Clean phone number: remove unwanted characters (commas, spaces)
96
- phone = ''.join(e for e in phone if e.isalnum()) # Keep only alphanumeric characters
97
 
98
  # Validate phone number to ensure it's exactly 10 digits
99
  if len(phone) != 10:
@@ -124,7 +123,7 @@ def login():
124
  login_mobile = data.get("mobile")
125
 
126
  # Clean phone number: remove unwanted characters (commas, spaces)
127
- login_mobile = ''.join(e for e in login_mobile if e.isalnum())
128
 
129
  if not login_email or not login_mobile:
130
  return jsonify({"success": False, "message": "Missing email or mobile number"}), 400
@@ -222,6 +221,7 @@ def get_order_history():
222
  result = sf.query(query)
223
  order_history = [{"order_id": item['Id'], "date": item['Order_Date__c'], "status": item['Status__c'], "total": item['Total_Amount__c']} for item in result['records']]
224
 
 
225
  return jsonify({"success": True, "order_history": order_history})
226
 
227
  except Exception as e:
 
1
  import torch
2
+ from flask import Flask, render_template, request, jsonify, session, redirect, url_for
3
  import json
4
  import os
5
  from transformers import pipeline
 
26
  print("Attempting to connect to Salesforce...")
27
  sf = Salesforce(username='diggavalli98@gmail.com', password='Sati@1020', security_token='sSSjyhInIsUohKpG8sHzty2q')
28
  print("Connected to Salesforce successfully!")
 
29
  except Exception as e:
30
  print(f"Failed to connect to Salesforce: {str(e)}")
31
 
 
92
  phone = data.get('phone')
93
 
94
  # Clean phone number: remove unwanted characters (commas, spaces)
95
+ phone = ''.join(e for e in phone if e.isdigit()) # Keep only digits
96
 
97
  # Validate phone number to ensure it's exactly 10 digits
98
  if len(phone) != 10:
 
123
  login_mobile = data.get("mobile")
124
 
125
  # Clean phone number: remove unwanted characters (commas, spaces)
126
+ login_mobile = ''.join(e for e in login_mobile if e.isdigit())
127
 
128
  if not login_email or not login_mobile:
129
  return jsonify({"success": False, "message": "Missing email or mobile number"}), 400
 
221
  result = sf.query(query)
222
  order_history = [{"order_id": item['Id'], "date": item['Order_Date__c'], "status": item['Status__c'], "total": item['Total_Amount__c']} for item in result['records']]
223
 
224
+ return jsonify({"success": True, "order_history":
225
  return jsonify({"success": True, "order_history": order_history})
226
 
227
  except Exception as e: