Skip to content

Commit

Permalink
ruff E722 Do not use bare except
Browse files Browse the repository at this point in the history
  • Loading branch information
avaldebe committed Aug 28, 2024
1 parent 5d5d085 commit a2fe6cb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/check_broken_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

"""See check_broken_links.py --help for usage"""

import os
import argparse
from datetime import datetime
import os
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime

import requests
import airbase as ab
from tqdm import tqdm

import airbase as ab

REQUESTS_SESSION_CONNECTION_POOL_SIZE = 10


def main(output_file, retries, ignore_errors=False):
"""Check the entire AirBase database for broken links"""

print("Will output bad links to {}".format(output_file))
print(f"Will output bad links to {output_file}")

client = ab.AirbaseClient()
req = client.request(preload_csv_links=True) # get links to all files
Expand All @@ -29,7 +29,7 @@ def is_404(url, r=retries):
try:
response = session.head(url, timeout=1)
return response.status_code == 404
except:
except Exception:
if r == 0 and not ignore_errors:
raise
elif r == 0 and ignore_errors:
Expand Down Expand Up @@ -70,7 +70,7 @@ def is_404(url, r=retries):
parser.add_argument(
"-o",
"--output",
default="bad-links-{}.txt".format(now),
default=f"bad-links-{now}.txt",
help="File to record the broken links in",
type=argparse.FileType(),
)
Expand Down

0 comments on commit a2fe6cb

Please sign in to comment.