使用python的requests结合rest-api上传文件到bmob服务器
import requests
def main():
url = "https://api2.bmob.cn/2/files/%s" % "HSSN-100L01L-M_1.jpg"
headers = {
"X-Bmob-Application-Id": "xxx",
"X-Bmob-REST-API-Key": "xxx",
"Content-Type": "image/jpeg",
}
data = open('./HSSN-100L01L-M_1.jpg', 'rb').read()
res = requests.post(url, headers=headers, data=data)
print(res)
print(list(res))
if __name__ == '__main__':
main()
网友评论