Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client fails in a confusing manner when token contains whitespace #598

Closed
TheFrozenFire opened this issue Jan 20, 2020 · 1 comment
Closed

Client fails in a confusing manner when token contains whitespace #598

TheFrozenFire opened this issue Jan 20, 2020 · 1 comment
Assignees
Labels

Comments

@TheFrozenFire
Copy link
Contributor

@TheFrozenFire TheFrozenFire commented Jan 20, 2020

Description

I load my API token from a file. The default behaviour of most file editors is to place a newline at the end of a file. Reading the API token from a file with that trailing newline results in failures that are not obviously related to the token containing that whitespace.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • 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.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

slackclient version: 2.5.0

python version: 3.6.8

OS version(s): any

Steps to reproduce:

  1. Open ~/.slacktoken in nano
  2. Paste API token into file and save
  3. Execute this Python code:
import slack
with open(expanduser('~/.slacktoken'), 'r') as f:
  slackclient = slack.WebClient(token=f.read(), run_async=True)
  slackclient.chat_postMessage(channel="somechannel", text="test")

Expected result:

{'ok': True, 'channel': 'somechannel', 'ts': '1579545629.000300', 'message': {'type': 'message', 'subtype': 'bot_message', 'text': 'test', 'ts': '1579545629.000300', 'username': 'Slack API Tester', 'bot_id': 'somebotid'}}

Actual result:

SlackApiError: The request to the Slack API failed.
The server responded with: {'ok': False, 'error': 'channel_not_found'}

Attachments:

wut

@stevengill stevengill added this to Backlog in SDKs and Tools Jan 29, 2020
@stevengill stevengill self-assigned this Jan 30, 2020
@stevengill stevengill moved this from Backlog to In Progress in SDKs and Tools Jan 30, 2020
@stevengill stevengill closed this Feb 13, 2020
@stevengill

This comment has been minimized.

Copy link
Contributor

@stevengill stevengill commented Feb 13, 2020

Thanks for filing the issue and sending the PR!

@stevengill stevengill moved this from In Progress to Done in SDKs and Tools Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.