Skip to content

Add ws_connect to ClientSession (cleaned up version of pull request #371 - figuring out the right way to do this)#374

Merged
asvetlov merged 5 commits intoaio-libs:masterfrom
davebshow:new_ws_session
May 22, 2015
Merged

Add ws_connect to ClientSession (cleaned up version of pull request #371 - figuring out the right way to do this)#374
asvetlov merged 5 commits intoaio-libs:masterfrom
davebshow:new_ws_session

Conversation

@davebshow
Copy link
Copy Markdown
Contributor

Added ClientSession.ws_connect method. Pretty much a copy paste of old websocket_client.ws_connect. The websocket_client.ws_connect now is very similar to client.request in that it creates a ClientSession with a TCPConnector(force_close=True) and calls that session's ws_connect method.

Had to change the mocks in the websocket client tests a bit.

@davebshow davebshow changed the title Cleaned up version of pull request #371 (figuring out the right way to do this) Add ws_connect to ClientSession (cleaned up version of pull request #371 - figuring out the right way to do this) May 20, 2015
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only possible other change I would make to this patch would be to move ws_response_class to the constructor function to be consistent with ClientSession.request method.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Please do.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed here that in the docs it lists the default params: request_class=None, response_class=None (and now ws_response_class=None). However, in the code base these are set to the default classes. Is this an oversight? Or is it intended to be that way?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation is wrong.
I've changed defaults but forgot to update doc.
Please fix to correct values.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. These params will not include the (optional) flag correct? Because some class must be passed as arg for each (although it is usually the default) . Like such:

:param request_class: Request class implementation. ClientRequest
by default.

:param response_class: Response class implementation.
ClientResponse by default.

:param ws_response_class: WebSocketResponse class implementation.
ClientWebSocketResponse by default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@davebshow
Copy link
Copy Markdown
Contributor Author

This patch should be ready for review after the appveyor CI completes. Unless there is something else to update/change...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add @asyncio.coroutine decorator.

@asvetlov
Copy link
Copy Markdown
Member

The code is pretty good.
Please fix my comments -- I'll merge PR after that.

@davebshow
Copy link
Copy Markdown
Contributor Author

Made all the additions.

asvetlov added a commit that referenced this pull request May 22, 2015
Add ws_connect to ClientSession (cleaned up version of pull request #371 - figuring out the right way to do this)
@asvetlov asvetlov merged commit 5f3605a into aio-libs:master May 22, 2015
@asvetlov
Copy link
Copy Markdown
Member

Perfect! Thanks!

@lock
Copy link
Copy Markdown

lock bot commented Oct 30, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 30, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants