作者:
Pear888 (皮爾掰)
2018-10-15 21:25:20不好意思想請教各位大大
小弟在heroku架了一個server來接收linebot的圖片訊息
接收到的圖片想直接存到google drive
在接收方面沒有問題
從line獲得的圖片內容是class 'bytes'的型態
把這個內容丟到pydrive的函式 SetContentString 卻出現 AttributeError: 'bytes' ob
ject has no attribute 'encode'
P.S. 這是SetContentString的函式
self.content = io.BytesIO(content.encode(encoding))
我嘗試用另一個方式
gfile.content = message_content
來傳送bytes形態的圖片,卻出現 AttributeError: bytes object has no attribute se
ek
小弟之前都是在本地端用setcontentfile的方式以檔案上傳,不知道在伺服器端如何以不
是檔案的方式傳送,在猜是不是要encode或decode的方式解決問題,懇請高手解答!