diff --git a/reqtools/sessions.py b/reqtools/sessions.py index ac1fbe6..5203b55 100644 --- a/reqtools/sessions.py +++ b/reqtools/sessions.py @@ -13,11 +13,12 @@ class RemoteApiSession(Session): __attrs__ = Session.__attrs__ + ['_base_url', '_prefix'] - def __init__(self, base_url: str, *, prefix: str = None): + def __init__(self, base_url: str, *, prefix: str = None, request_timeout: int = None): super().__init__() self._base_url = base_url self._prefix = prefix + self._request_timeout = request_timeout def __repr__(self): return f'{self.__class__.__name__}({self.url})' @@ -35,6 +36,8 @@ def url(self): return self._build_url(self._base_url, self._prefix) def request(self, method: str, url_path: str, **kwargs): + if self._request_timeout: + kwargs.setdefault('timeout', self._request_timeout) url = self._build_url(self.url, url_path)