我正在尝试使用api调用users.profile.get
来查找用户配置文件图片。问题是请求不需要JSON,而需要URL编码的查询(我认为是?)。我已经有了用户id,但是我需要知道如何正确地将它发送到slack,最好使用api_call
方法。怎么做我会同意这样做吗?你知道吗
以下是文档:https://api.slack.com/methods/users.profile.get
for users in collection.find():
start_date, end_date = users['start_date'], users['end_date']
user_data = client.api_call('users.profile.get',
"""What would I do here?""")
user_images[users['user_id']] = user_data['image_72']
block.section(
text=
f'from *{date_to_words(start_date[0], start_date[1], start_date[2])}* to *{date_to_words(end_date[0], end_date[1], end_date[2])}*'
)
block.context(data=((
'img', user_images[users['user_id']],
'_error displaying image_'
), ('text',
f'<!{users["user_id"]}>. _Contact them if you have any concerns_'
)))
在函数调用中,可以将API的参数作为names参数传递。你知道吗
为了users.get.profile文件您需要提供用户ID,例如“U1245678”。你知道吗
然后您的调用将如下所示(使用slackclient v1):
或者类似于slackclient v2:
回答您的问题:您不必担心如何调用API,因为这是由库处理的。但从技术上讲,大多数Slack的API端点都接受URL格式和JSON格式的参数。你知道吗
相关问题 更多 >
编程相关推荐