rbughao commited on
Commit
6085c65
·
verified ·
1 Parent(s): ce8f3a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -57,7 +57,7 @@ def check_robots(url):
57
  if response.status_code == 200 or response.status_code == 401:
58
  return('OK')
59
  else:
60
- return('Not OK')
61
  except requests.exceptions.RequestException as e:
62
  print(f"Error checking {url}: {e}")
63
  return None
@@ -70,7 +70,7 @@ def check_sitemap(url):
70
  if response.status_code == 200 or response.status_code == 401:
71
  return('OK')
72
  else:
73
- return('Not OK')
74
  except requests.exceptions.RequestException as e:
75
  print(f"Error checking {url}: {e}")
76
  return None
@@ -111,9 +111,9 @@ def check_site_speed(url):
111
  return None
112
 
113
  def runchecks(message,history):
114
- results = []
115
- results.append(['Website','Speed in Seconds'])
116
  if message == 'run now' or message == 'Run Now':
 
117
  for site in websites:
118
  print(f"Checking site speed for {site}...")
119
  speed = check_site_speed(site)
@@ -124,6 +124,7 @@ def runchecks(message,history):
124
  df_log = pd.DataFrame(results)
125
  return str(df_log)
126
  elif message == 'check bots' or message == 'Check Bots':
 
127
  for site in BTsites:
128
  print(f"Checking robots.txt for {site}...")
129
  botsCheck = check_robots(site)
@@ -134,6 +135,7 @@ def runchecks(message,history):
134
  df_log = pd.DataFrame(results)
135
  return str(df_log)
136
  elif message == 'check sitemaps' or message == 'Check Sitemaps':
 
137
  for site in BTsites:
138
  print(f"Checking sitemaps for {site}...")
139
  mapsCheck = check_sitemap(site)
 
57
  if response.status_code == 200 or response.status_code == 401:
58
  return('OK')
59
  else:
60
+ return(response.status_code)
61
  except requests.exceptions.RequestException as e:
62
  print(f"Error checking {url}: {e}")
63
  return None
 
70
  if response.status_code == 200 or response.status_code == 401:
71
  return('OK')
72
  else:
73
+ return(response.status_code)
74
  except requests.exceptions.RequestException as e:
75
  print(f"Error checking {url}: {e}")
76
  return None
 
111
  return None
112
 
113
  def runchecks(message,history):
114
+ results = []
 
115
  if message == 'run now' or message == 'Run Now':
116
+ results.append(['Website','Speed in Seconds'])
117
  for site in websites:
118
  print(f"Checking site speed for {site}...")
119
  speed = check_site_speed(site)
 
124
  df_log = pd.DataFrame(results)
125
  return str(df_log)
126
  elif message == 'check bots' or message == 'Check Bots':
127
+ results.append(['Website','Bots Status'])
128
  for site in BTsites:
129
  print(f"Checking robots.txt for {site}...")
130
  botsCheck = check_robots(site)
 
135
  df_log = pd.DataFrame(results)
136
  return str(df_log)
137
  elif message == 'check sitemaps' or message == 'Check Sitemaps':
138
+ results.append(['Website','Sitemap Status'])
139
  for site in BTsites:
140
  print(f"Checking sitemaps for {site}...")
141
  mapsCheck = check_sitemap(site)