前提・実現したいこと
実行するとラズパイに写真ファイルが生成し、lineにメッセージが送信しました。
しかし、写真が送られできません。エラーメッセージが出ていません。
発生している問題・エラーメッセージ
python
1import sys 2import cv2 3import time 4import datetime 5import requests 6 7while True: 8 9 nowphoto = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") 10 11 cc = cv2.VideoCapture(0) 12 13 rr, img = cc.read() 14 image_file = nowphoto + '.jpg' 15 cv2.imwrite(image_file,img) 16 cc.release() 17 18 line_notify_token = 'xxxxxxxxxxxxxxxxx' 19 line_notify_api = 'https://notify-api.line.me/api/notify' 20 message = '通知したい内容' 21 payload = {'message': message} 22 headers = {'Authorization': 'Bearer ' + line_notify_token} # 発行したトークン 23 files = {"imageFile": open(image_file, "rb")} 24 line_notify = requests.post(line_notify_api, data=payload, headers=headers) 25 26 time.sleep(1)
あなたの回答
tips
プレビュー