Commits

lakin.wecker committed b725672 Draft

fixing the browser to include a timeout.

Comments (0)

Files changed (1)

slurpy/browsers.py

     #Referer http://en.wikipedia.org/wiki/HTTP_referer
 
     #---------------------------------------------------------------------------
-    def __init__(self, headers=None, user_agent=None, language=None, proxies=None):
+    def __init__(self, headers=None, user_agent=None, language=None, proxies=None, timeout=1.0):
         """Initializes the browser.
 
         User may provide custom headers or user_agent if they wish. If not
         if not proxies:
             proxies = {}
         self.proxies = proxies
+        self.timeout = timeout
 
         self.referer = None
         self.headers = self.browser_wide_headers.copy()
         proxies.update(self.proxies)
         kwargs['proxies'] = proxies
 
+        # Generaly setup the timeout.
+        timeout = kwargs.get('timeout', self.timeout)
+        kwargs['timeout'] = timeout
+
         # Store it from the next time
         self.referer = url