Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,8 +3,8 @@ import requests
|
|
3 |
import pandas as pd
|
4 |
|
5 |
# ---------------------- CONFIG ----------------------
|
6 |
-
CLIENT_ID = "YOUR_CLIENT_ID"
|
7 |
-
CLIENT_SECRET = "YOUR_CLIENT_SECRET"
|
8 |
USERNAME = "[email protected]"
|
9 |
PASSWORD = "Vedavathi@04"+"qe4His8AcuFJucZz5NBHfGU"
|
10 |
TOKEN_URL = "https://login.salesforce.com/services/oauth2/token"
|
@@ -15,8 +15,8 @@ API_VERSION = "v60.0"
|
|
15 |
def get_salesforce_token():
|
16 |
data = {
|
17 |
"grant_type": "password",
|
18 |
-
CLIENT_ID = "YOUR_CLIENT_ID"
|
19 |
-
CLIENT_SECRET = "YOUR_CLIENT_SECRET"
|
20 |
"username": "[email protected]",
|
21 |
"password": "Vedavathi@04"
|
22 |
}
|
@@ -32,7 +32,7 @@ def fetch_pole_data(instance_url, access_token):
|
|
32 |
headers = {
|
33 |
"Authorization": f"Bearer {access_token}"
|
34 |
}
|
35 |
-
query = "SELECT
|
36 |
url = f"{instance_url}/services/data/{API_VERSION}/query?q={query}"
|
37 |
response = requests.get(url, headers=headers)
|
38 |
if response.status_code != 200:
|
@@ -40,7 +40,7 @@ def fetch_pole_data(instance_url, access_token):
|
|
40 |
return pd.DataFrame()
|
41 |
records = response.json().get("records", [])
|
42 |
df = pd.DataFrame(records)
|
43 |
-
return df[[
|
44 |
|
45 |
# ---------------------- UI ----------------------
|
46 |
st.title("🚦Vedavathi Smart Poles Viewer")
|
|
|
3 |
import pandas as pd
|
4 |
|
5 |
# ---------------------- CONFIG ----------------------
|
6 |
+
#CLIENT_ID = "YOUR_CLIENT_ID"
|
7 |
+
#CLIENT_SECRET = "YOUR_CLIENT_SECRET"
|
8 |
USERNAME = "[email protected]"
|
9 |
PASSWORD = "Vedavathi@04"+"qe4His8AcuFJucZz5NBHfGU"
|
10 |
TOKEN_URL = "https://login.salesforce.com/services/oauth2/token"
|
|
|
15 |
def get_salesforce_token():
|
16 |
data = {
|
17 |
"grant_type": "password",
|
18 |
+
#CLIENT_ID = "YOUR_CLIENT_ID"
|
19 |
+
#CLIENT_SECRET = "YOUR_CLIENT_SECRET"
|
20 |
"username": "[email protected]",
|
21 |
"password": "Vedavathi@04"
|
22 |
}
|
|
|
32 |
headers = {
|
33 |
"Authorization": f"Bearer {access_token}"
|
34 |
}
|
35 |
+
query = "SELECT Name, Location_Latitude__c, Location_Longitude__c ,Camera_Status__c FROM Pole__c LIMIT 100"
|
36 |
url = f"{instance_url}/services/data/{API_VERSION}/query?q={query}"
|
37 |
response = requests.get(url, headers=headers)
|
38 |
if response.status_code != 200:
|
|
|
40 |
return pd.DataFrame()
|
41 |
records = response.json().get("records", [])
|
42 |
df = pd.DataFrame(records)
|
43 |
+
return df[[ "Name", "Location_Latitude__c","Location_Longitude__c", "Camera_Status__c"]]
|
44 |
|
45 |
# ---------------------- UI ----------------------
|
46 |
st.title("🚦Vedavathi Smart Poles Viewer")
|