Skip to content

Commit

Permalink
Issue #58: Catch UrlInfo read exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekmo committed Oct 22, 2018
1 parent bbf0fa6 commit 573114b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dirhunt/url_info.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import re
import socket
import string
import sys
from operator import itemgetter
Expand All @@ -10,6 +11,7 @@
from click import get_terminal_size
from colorama import Fore
from requests import RequestException
from urllib3.exceptions import ReadTimeoutError

from dirhunt.cli import random_spinner
from dirhunt.colors import status_code_colors
Expand Down Expand Up @@ -57,7 +59,7 @@ def get_data(self):
raise RequestError
try:
text = resp.raw.read(MAX_RESPONSE_SIZE, decode_content=True)
except RequestException:
except (RequestException, ReadTimeoutError, socket.timeout):
raise RequestError
try:
soup = BeautifulSoup(text, 'html.parser')
Expand Down

0 comments on commit 573114b

Please sign in to comment.