Commit b9ac6edd authored by kaiyou's avatar kaiyou

Add request timeouts for TCP checks

parent 4211c369
Pipeline #208 passed with stage
in 1 minute and 33 seconds
......@@ -5,7 +5,7 @@ import requests_html
def get(context, url, expected_code=200, expected_string=None):
""" Run a GET http request and test the HTTP response code
"""
req = requests.get(url)
req = requests.get(url, timeout=5.0)
if expected_code != req.status_code:
up = False
message = "the page returned code {}".format(req.status_code)
......@@ -28,7 +28,7 @@ def get_xpath(context, url, query, result_type="str", destination="message"):
"""
cast = {"str": str, "int": int, "float": float, "bool": bool}[result_type]
session = requests_html.HTMLSession()
req = session.get(url)
req = session.get(url, timeout=5.0)
result = req.html.xpath(query, first=True)
return {
"up": True,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment