如何获得像“Jonh”这样的用户名而不是WLLACM2HK??你知道吗
代码
starterbot_id = web_client.api_call("auth.test")["user_id"]
print("starterbot id------->"+starterbot_id))
上述代码的电流输出
starterbot id------->WLLACM2HK
我想要的代码打印如下输出的东西
starterbot id------->Jonh
web中的数据_client.api\u调用("认证测试“”)
{
'ok': True,
'url': 'https: //bby-sandbox-general.slack.com/',
'team': 'SandboxGeneralWorkspace',
'user': 'ipt-autobot',
'team_id': 'TFHGD33RV',
'user_id': 'WLLACM2HK',
'bot_id': 'BLDVB7EKB',
'enterprise_id': 'EFGBDRLNP',
'warning': 'superfluous_charset',
'response_metadata': {
'warnings': [
'superfluous_charset'
]
}
}
我觉得我没有调用正确的api,因为我在上面的json中没有看到用户名,user属性实际上是slack bot的名称,我想打印在slack bot中发短信的用户
试印(网络)_client.users\u信息(user=用户)
{
'ok': True,
'user': {
'id': 'WGUHC67D1',
'team_id': 'TJK2GBSC9',
'name': 'a6002043',
'deleted': False,
'color': 'c386df',
'real_name': 'RaviKanth',
'tz': 'America/Chicago',
'tz_label': 'CentralStandardTime',
'tz_offset': -21600,
'profile': {
'title': 'CW-Other',
'phone': '+15614128585',
'skype': '',
'real_name': 'RaviKanth',
'real_name_normalized': 'RaviKanth',
'display_name': 'RaviKanth',
'display_name_normalized': 'RaviKanth',
'status_text': '',
'status_emoji': '',
'status_expiration': 0,
'avatar_hash': '8f97c61708c1',
'image_original': 'https: //avatars.slack-edge.com/2019-11-27/852421659589_8f97c61708c1553628c8_original.jpg',
'is_custom_image': True,
如何抓取实名值并打印出来?你知道吗
我正在研究它,如果您有
user_id
,那么您可以使用user.info
方法来获取特定的用户信息。你知道吗举个例子:![Image](https://i.stack.imgur.com/q63G2.png)
链接:https://api.slack.com/methods/users.info
相关问题 更多 >
编程相关推荐