Skip to content

Return rtm.start API response to callers of rtm_connect() #181

@Terrance

Description

@Terrance
  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Description

The rtm.start API method returns a lot of useful information, which would otherwise require multiple API calls to retrieve. Currently SlackServer.rtm_connect() discards it all, and SlackClient.rtm_connect() just returns a bool for whether the connection succeeded. It would be more useful to return the whole response (login_data in this case) for further processing.

This would affect the method signature, but is effectively backwards-compatible for callers that just test truthiness of the result.

/cc #50 and #175, which allow raising an exception on failure -- I think a nice solution would be a combination that either returns the full dict on success, or raises an exception on failure.

Reproducible in:

  • This is reproducible in the sample project.
    python-slackclient version: current master

Expected result:

>>> SlackClient(...).rtm_connect()
{'ok': True, 'url': 'wss:\\/\\/ms9.slack-msgs.com\\/websocket\\/7I5yBpcvk',
 'self': {...}, 'team': {...}, 'users': [...], ...}

Actual result:

>>> SlackClient(...).rtm_connect()
True

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions