Skip to content

Commit

Permalink
Fix #1149: Publish ClientSession.loop property
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Sep 13, 2016
1 parent 7d87602 commit 439168c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ CHANGES

- Add `multipart` coroutine method for web Request object #1067

- Publish ClientSession.loop property #1149

-

-
Expand Down
5 changes: 5 additions & 0 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,11 @@ def version(self):
"""The session HTTP protocol version."""
return self._version

@property
def loop(self):
"""Session's loop."""
return self._loop

def detach(self):
"""Detach connector from session without closing the former.
Expand Down
5 changes: 5 additions & 0 deletions docs/client_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ The client session supports the context manager protocol for self closing.
A read-only property. Overriding `session.cookies = new_val` is
forbidden, but you may modify the object in-place if needed.

.. attribute:: loop

A loop instance used for session creation.

A read-only property.

.. comethod:: request(method, url, *, params=None, data=None,\
headers=None, skip_auto_headers=None, \
Expand Down
5 changes: 5 additions & 0 deletions tests/test_client_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,3 +418,8 @@ def handler(request):
def test_session_default_version(loop):
session = aiohttp.ClientSession(loop=loop)
assert session.version == aiohttp.HttpVersion11


def test_session_loop(loop):
session = aiohttp.ClientSession(loop=loop)
assert session.loop is loop

0 comments on commit 439168c

Please sign in to comment.