Skip to content

Commit

Permalink
clean up check error log.
Browse files Browse the repository at this point in the history
  • Loading branch information
diversen7 committed Oct 21, 2024
1 parent 58d4156 commit 3a4cec2
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions bin/check_error_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,30 @@ def check_url(url):
# Print the number of unresolved URLs
num_unresolved = len(unresolved_errors)
print(f"Found {num_unresolved} unresolved URLs")
print("Checking...")
print("-" * 50)

# Check the status of each unresolved URL
for error_id, url, error in unresolved_errors:
print(url)
print(f"Error: {error}")

if error == "500 Error":
print(f"Checking {error}")
url = url.strip()
http_status_code = check_url(url)

print(f"Current status code: {http_status_code}")

url = url.strip()
status = check_url(url)
if error == "500 Error":

# If the URL is working (status code 200), mark it as resolved
resolved_statuses = [200, 301, 302, 400, 404]
if status in resolved_statuses:
if http_status_code in resolved_statuses:
mark_url_resolved(error_id)
print(f"{url} marked as resolved. Status code: {status}")
print("URL is now marked as resolved")
else:
print(f"{url} is still unresolved. Status code: {status}")

# Sleep to avoid overwhelming the server
time.sleep(1)
print("URL is still unresolved")
else:
print(f"Skipping internal error with correct status code {error}")
print("URL is still unresolved - but status code is not 500")

print("-" * 50)
time.sleep(1)

0 comments on commit 3a4cec2

Please sign in to comment.