티스토리 뷰

공부

[Slack] send image

승가비 2021. 1. 14. 07:36
728x90
from slacker import Slacker

from PIL import Image
import requests
import os

image = "{url}"

slack = Slacker(token)

file = Image.open(requests.get(image, stream=True).raw)
filename = DateUtils.timestamp() + '.png'
file.save(filename)

slack.files.upload(filename, channels='#' + channel)

os.remove(filename)

https://pydole.tistory.com/entry/Slack-%ED%99%9C%EC%9A%A9-python%EC%9D%84-%EC%9D%B4%EC%9A%A9%ED%95%9C-Slack-%EB%A9%94%EC%84%B8%EC%A7%80-%EB%B3%B4%EB%82%B4%EA%B8%B0

 

[Python] Send Slack Massages and upload file

Token : https://api.slack.com/custom-integrations/legacy-tokens Legacy tokens Learn how to build bot users, send notifications, and interact with workspaces using our APIs. api.slack.com Slack에 채..

pydole.tistory.com

 

728x90

'공부' 카테고리의 다른 글

[Slack] slacker.Error: missing_scope  (0) 2021.01.14
[Chart.js] make chart image  (0) 2021.01.14
[Python] datetime, timestamp  (0) 2021.01.14
[Java] URLEncode  (0) 2021.01.14
[PHP] join -> implode; split -> explode  (0) 2021.01.14
댓글