请求网址:“https://mp.csdn.net/postedit/saveArticle”
Headers要求数据:
cookie:用于登录
content-type:application/x-www-form-urlencoded; charset=UTF-8
Data发送数据:
-
titl:Test 文章标题
-
typ:1
-
cont:<table border="1" cellpadding="1" cellspacing="1" style="width:500px"> <tbody> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>3</td> <td>4</td> </tr> <tr> <td>5</td> <td>6</td> </tr> </tbody> </table> <p> </p> 博客内容
-
categories:C++ 文章分类
-
chnl:16
-
level:0
-
tag2: 标签
-
artid:0
-
private:false
-
stat:publish
代码:
import requests
url = 'https://mp.csdn.net/postedit/saveArticle'
header={
'cookie':'别想知道我的=.=',
'content-type':'application/x-www-form-urlencoded; charset=UTF-8'
}
content='''
<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
<tbody>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>5</td>
<td>6</td>
</tr>
</tbody>
</table>
<p> </p>
'''
data={
'titl':'API Test',
'typ':'1',
'cont':content,
'categories':'Test',
'chnl':'16',
'level':'0',
'artid':'0',
'private':'false',
'stat':'publish',
}
res = requests.post(url, headers=header, data=data)
print(res)