我有curl代码收到了一个图像文件
curl -X GET -H 'Authorization: Bearer TOKENS' https://api.line.me/v2/bot/message/8595925133330/content -o image.png
如何使用python获取文件?
最佳答案
curl -X GET -H 'Authorization: Bearer TOKENS' https://api.line.me/v2/bot/message/8595925133330/content -o image.png
类似的 Python 脚本应如下所示:
import requests
endpoint = "https://api.line.me/v2/bot/message/8595925133330/content"
headers = {"Authorization":"Bearer TOKENS"}
r = requests.post(endpoint,headers=headers)
open('image.png', 'wb').write(r.content)
关于python - 如何使用 python curl 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52406211/