joshuadunlop commited on
Commit
a32188a
·
1 Parent(s): 34291e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -5,7 +5,7 @@ import streamlit as st
5
  from datetime import datetime, timedelta
6
 
7
  # Function to fetch data from ShareASale
8
- def fetch_shareasale_data(action_verb, affiliate_id, api_token, api_secret_key, api_version=2.4):
9
  my_timestamp = strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
10
  data = parse.urlencode({
11
  'affiliateId': affiliate_id,
@@ -34,17 +34,17 @@ def fetch_shareasale_data(action_verb, affiliate_id, api_token, api_secret_key,
34
  st.title("Affiliate Earnings Dashboard")
35
  st.sidebar.title("Settings")
36
 
 
 
 
 
 
37
  # Date range picker
38
  start_date = st.sidebar.date_input("Start Date", datetime.now() - timedelta(days=30))
39
  end_date = st.sidebar.date_input("End Date", datetime.now())
40
 
41
  # Fetch data button
42
  if st.sidebar.button("Fetch Data"):
43
- # Placeholder for your API credentials
44
- my_affiliate_id = 'YOUR_AFFILIATE_ID'
45
- api_token = 'YOUR_API_TOKEN'
46
- api_secret_key = 'YOUR_API_SECRET_KEY'
47
-
48
  # Fetch data from ShareASale
49
  action_verb = 'ledger'
50
  ledger_data = fetch_shareasale_data(action_verb, my_affiliate_id, api_token, api_secret_key)
 
5
  from datetime import datetime, timedelta
6
 
7
  # Function to fetch data from ShareASale
8
+ def fetch_shareasale_data(action_verb, affiliate_id, api_token, api_secret_key, api_version=1.4):
9
  my_timestamp = strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
10
  data = parse.urlencode({
11
  'affiliateId': affiliate_id,
 
34
  st.title("Affiliate Earnings Dashboard")
35
  st.sidebar.title("Settings")
36
 
37
+ # API and credential settings
38
+ my_affiliate_id = st.sidebar.text_input("Affiliate ID", "YOUR_AFFILIATE_ID")
39
+ api_token = st.sidebar.text_input("API Token", "YOUR_API_TOKEN")
40
+ api_secret_key = st.sidebar.text_input("API Secret Key", "YOUR_API_SECRET_KEY", type="password")
41
+
42
  # Date range picker
43
  start_date = st.sidebar.date_input("Start Date", datetime.now() - timedelta(days=30))
44
  end_date = st.sidebar.date_input("End Date", datetime.now())
45
 
46
  # Fetch data button
47
  if st.sidebar.button("Fetch Data"):
 
 
 
 
 
48
  # Fetch data from ShareASale
49
  action_verb = 'ledger'
50
  ledger_data = fetch_shareasale_data(action_verb, my_affiliate_id, api_token, api_secret_key)