Skip to content

Commit

Permalink
DIV-000: Ignore SSL errors for link check
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanrogowsky-oxd committed Dec 12, 2024
1 parent 4b58835 commit 4993216
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion edivorce/apps/core/management/commands/link_check.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import os
import sys
import warnings

import requests
from bs4 import BeautifulSoup
from django.conf import settings
from django.core.management.base import BaseCommand
from requests.packages.urllib3.exceptions import InsecureRequestWarning

# Suppress only the single InsecureRequestWarning from urllib3 needed
warnings.simplefilter('ignore', InsecureRequestWarning)


class Command(BaseCommand):
Expand All @@ -26,7 +31,7 @@ class Command(BaseCommand):
def _check_link(self, session, address):
try:
print(f'Checking link: {address}')
response = session.get(address, headers=self.HEADERS, timeout=15)
response = session.get(address, headers=self.HEADERS, timeout=15, verify=False)
response.raise_for_status()
except requests.exceptions.Timeout:
return None # Ignore timeouts
Expand Down

0 comments on commit 4993216

Please sign in to comment.