Skip to content

Commit

Permalink
Retry get request if 404
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderDokuchaev committed Apr 9, 2024
1 parent c548848 commit 08f1099
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion md_dead_link_check/link_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ async def process_link(link: str, session: ClientSession, config: Config) -> Lin
response = await session.get(**kwargs)
else:
response = await session.head(**kwargs)

if response.status == 404:
# Some web sites are not supports head request and return 404 code
response = await session.get(**kwargs)
response.raise_for_status()
except ClientResponseError as e:
if not config.catch_response_codes or e.status in config.catch_response_codes:
Expand Down

0 comments on commit 08f1099

Please sign in to comment.