python slackclient userslist

时间:2017-07-28 00:45:04

标签: python json slack-api

我正在尝试使用python slackclient。 我得到json.decoder.JSONDecodeError:期望值:第1行第1列(char 0)错误,在下面的代码中打印(slack_client.api_call(" users.list"))。我试过这样,但仍然得到错误,打印(json.loads(slack_client.api_call(" users.list"))) 请建议可能出错的地方, 前2个api调用工作正常并返回结果。只有用户列表api调用才给我错误

print (slack_client.api_call("api.test"))
print (slack_client.api_call("auth.test"))
print (slack_client.api_call("users.list"))

Traceback (most recent call last):
  File "print_bot_id.py", line 15, in <module>
    print (slack_client.api_call("users.list"))
  File "/Users/vt/anaconda3/lib/python3.6/site-packages/slackclient/_client.py", line 83, in api_call
    result = json.loads(self.server.api_call(method, timeout=timeout, **kwargs))
  File "/Users/vt/anaconda3/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/Users/vt/anaconda3/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Users/vt/anaconda3/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@smarx,curl for users.list端点什么都不返回,有不同的终点

    $ curl -X POST https://slack.com/api/api.test?token='abc'
{"ok":true,"args":{"token":"abc"}}
m-C02KL0B1FFT4:slack_bot vt$ curl -X POST https://slack.com/api/users.list?token='abc'
$

0 个答案:

没有答案