@@ -4756,7 +4756,7 @@ def get_link_status_code(
4756
4756
):
4757
4757
"""Get the status code of a link.
4758
4758
If the timeout is set to less than 1, it becomes 1.
4759
- If the timeout is exceeded by requests.get (), it will return a 404.
4759
+ If the timeout is exceeded by requests.head (), it will return a 404.
4760
4760
If "verify" is False, will ignore certificate errors.
4761
4761
For a list of available status codes, see:
4762
4762
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
@@ -4794,6 +4794,8 @@ def assert_no_404_errors(self, multithreaded=True, timeout=None):
4794
4794
"""Assert no 404 errors from page links obtained from:
4795
4795
"a"->"href", "img"->"src", "link"->"href", and "script"->"src".
4796
4796
Timeout is on a per-link basis using the "requests" library.
4797
+ If timeout is None, uses the one set in get_link_status_code().
4798
+ (That timeout value is currently set to 5 seconds per link.)
4797
4799
(A 404 error represents a broken link on a web page.)
4798
4800
"""
4799
4801
all_links = self.get_unique_links()
@@ -4830,7 +4832,7 @@ def assert_no_404_errors(self, multithreaded=True, timeout=None):
4830
4832
for link in links:
4831
4833
if self.__get_link_if_404_error(link):
4832
4834
broken_links.append(link)
4833
- self.__requests_timeout = None # Reset the requests.get () timeout
4835
+ self.__requests_timeout = None # Reset the requests.head () timeout
4834
4836
if len(broken_links) > 0:
4835
4837
broken_links = sorted(broken_links)
4836
4838
bad_links_str = "\n".join(broken_links)
0 commit comments