Skip to content

Commit

Permalink
Clientsession timeout property (#4193)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunitdev authored and asvetlov committed Oct 18, 2019
1 parent 60f01cc commit c0a36b2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/4191.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added `ClientSession.timeout` property.
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ Stepan Pletnev
Stephen Granade
Steven Seguin
Sunghyun Hwang
Sunit Deshpande
Sviatoslav Bulbakha
Sviatoslav Sydorenko
Taha Jahangir
Expand Down
5 changes: 5 additions & 0 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,11 @@ def loop(self) -> asyncio.AbstractEventLoop:
stacklevel=2)
return self._loop

@property
def timeout(self) -> Union[object, ClientTimeout]:
"""Timeout for the session."""
return self._timeout

def detach(self) -> None:
"""Detach connector from session without closing the former.
Expand Down
10 changes: 10 additions & 0 deletions tests/test_client_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,16 @@ async def test_client_session_timeout_args(loop) -> None:
conn_timeout=30 * 60)


async def test_client_session_timeout_default_args(loop) -> None:
session1 = ClientSession()
assert session1.timeout == client.DEFAULT_TIMEOUT


async def test_client_session_timeout_argument() -> None:
session = ClientSession(timeout=500)
assert session.timeout == 500


async def test_requote_redirect_url_default() -> None:
session = ClientSession()
assert session.requote_redirect_url
Expand Down

0 comments on commit c0a36b2

Please sign in to comment.