ChatWork에 이미지 업로드 in Python
Requirement
Program
import requests
END_POINT = 'https://api.chatwork.com/v2/'
API_TOKEN = 'your api token'
def post_jpeg(room_id, file_path, message=''):
url = '{}rooms/{}/files'.format(END_POINT, room_id)
jpeg_bin = open(file_path, 'rb')
headers = {'X-ChatWorkToken': API_TOKEN}
files = {
'file': ('kawaii.jpg', jpeg_bin, 'image/jpeg'),
'message': message,
}
request = requests.post(url, headers=headers, files=files)
room_id = 'your room id'
file_path = './hoge.jpg'
message = '正義'
post_jpeg(room_id, file_path, message)
힌트
post_jpeg
files = {'file': ('kawaii.jpg', jpeg_bin, 'image/jpeg')}
Reference
Reference
이 문제에 관하여(ChatWork에 이미지 업로드 in Python), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/Doarakko/items/b7f44c227cd712da1051텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)