joshuadunlop commited on
Commit
d743cd0
·
verified ·
1 Parent(s): d0479df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -12,7 +12,7 @@ def get_backlinks(api_login, api_key, target_url, filters):
12
  'Authorization': f'Basic {encoded_credentials}'
13
  }
14
 
15
- # Prepare post data with filters as a list of lists
16
  post_data = {
17
  0: {
18
  "target": target_url,
@@ -25,6 +25,10 @@ def get_backlinks(api_login, api_key, target_url, filters):
25
  # Making the API request
26
  response = requests.post("https://api.dataforseo.com/v3/backlinks/backlinks/live", json=post_data, headers=headers)
27
 
 
 
 
 
28
  # Check if the response contains 'results' key
29
  if response.status_code == 200 and 'results' in response.json():
30
  # Extract the results
@@ -41,6 +45,7 @@ def get_backlinks(api_login, api_key, target_url, filters):
41
  error_message = response.json().get('status_message', 'No specific error message provided')
42
  st.error(f"Error: Code: {response.status_code} Message: {error_message}")
43
  return None
 
44
 
45
  # Streamlit layout
46
  st.sidebar.title("DataForSEO API Parameters")
 
12
  'Authorization': f'Basic {encoded_credentials}'
13
  }
14
 
15
+ # Prepare post data
16
  post_data = {
17
  0: {
18
  "target": target_url,
 
25
  # Making the API request
26
  response = requests.post("https://api.dataforseo.com/v3/backlinks/backlinks/live", json=post_data, headers=headers)
27
 
28
+ # Log the full response for debugging
29
+ st.text("API Response:")
30
+ st.json(response.json()) # This will display the full JSON response in the Streamlit app
31
+
32
  # Check if the response contains 'results' key
33
  if response.status_code == 200 and 'results' in response.json():
34
  # Extract the results
 
45
  error_message = response.json().get('status_message', 'No specific error message provided')
46
  st.error(f"Error: Code: {response.status_code} Message: {error_message}")
47
  return None
48
+
49
 
50
  # Streamlit layout
51
  st.sidebar.title("DataForSEO API Parameters")