Skip to content
Browse files

Revert "Revert "Merge pull request #161 from casschin/get-response-co…

…de-timeout""

This reverts commit eaa61ac.
  • Loading branch information...
1 parent eaa61ac commit e28f46b85dbc1b617b6705ce161f7c5d700a7017 @retornam retornam committed Feb 5, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −2 pages/page.py
View
8 pages/page.py
@@ -15,6 +15,7 @@
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import ElementNotVisibleException
+from requests.exceptions import Timeout
http_regex = re.compile('https?://((\w+\.)+\w+\.\w+)')
@@ -100,5 +101,8 @@ def wait_for_ajax(self):
def get_response_code(self, url):
# return the response status
requests_config = {'max_retries': 5}
- r = requests.get(url, verify=False, config=requests_config)
- return r.status_code
+ try:
+ r = requests.get(url, verify=False, allow_redirects=True, config=requests_config, timeout=self.timeout)
+ return r.status_code
+ except Timeout:
+ return 408

0 comments on commit e28f46b

Please sign in to comment.
Something went wrong with that request. Please try again.