0
点赞
收藏
分享

微信扫一扫

关于CSDN博客上传图片的接口研究

天蓝Sea 2022-06-23 阅读 135

代码实现

import requests
from requests_toolbelt import MultipartEncoder
import urllib.parse
fields = {
'file':("004.jpg",open('004.jpg','rb'),"image/jpeg"), #这里上传的图片是 004.jpg
}

m = MultipartEncoder(fields, boundary='------WebKitFormBoundarynTBa3OWoSMrcVf0F')

headers = {
'cookie': '', #填写自己登录博客的cookie
'content-Type': m.content_type,
}
url =
res = requests.post(url, headers=headers, data=m, verify=False)
print(res.json())

这个是我通过抓包获取的​​csdn博客​​上传图片的接口,需要个人用户登录,需要cookie


作者:​​Hello_wshuo​​​


举报

相关推荐

0 条评论