Update check_cards.py

Add url check to image2
This commit is contained in:
Cal Corum 2023-10-17 09:01:49 -05:00
parent 8c2a2f5220
commit dc798a81d4

View File

@ -49,10 +49,10 @@ async def main(args):
pass
elif 'batting' in x['image'] and 'skip_bats' in arg_data and arg_data['skip_bats'].lower() == 'true':
pass
elif 'sombaseball' in x['image']:
errors.append((x, f'Bad card url: {x["image"]}'))
elif 'start_id' in arg_data and int(arg_data['start_id']) > x['player_id']:
pass
elif 'sombaseball' in x['image']:
errors.append((x, f'Bad card url: {x["image"]}'))
else:
count += 1
if count % 20 == 0:
@ -90,21 +90,24 @@ async def main(args):
else:
card_url = x['image2']
try:
resp = await url_get(card_url, timeout=6)
except ConnectionError as e:
if cxn_error:
raise e
cxn_error = True
errors.append((x, e))
except ValueError as e:
errors.append((x, e))
if 'sombaseball' in x['image2']:
errors.append((x, f'Bad card url: {x["image"]}'))
else:
successes.pop(x)
try:
resp = await url_get(card_url, timeout=6)
except ConnectionError as e:
if cxn_error:
raise e
cxn_error = True
errors.append((x, e))
except ValueError as e:
errors.append((x, e))
else:
successes.pop(x)
if len(errors) > 0:
logging.error(f'All Errors:')