import requests
conten = {'title': '测试标题',
"article": '227)">814.net.cn</a></address></li>h'
'ttps://g.csdnimg.cn/static/logo/favicon32.ico""SHORTCUThtt'
'ps://www.anyachina.cn/"SHORTCUThttps://www.baidu.com/"SHORTCUT'}
def wp_post(content):
api = '' #这里用的是免登陆api,跟火车头免登发布接口是一样的
from_data = {
'post_title': content.get('title'), # 必选 标题
'post_content': content.get('article'), # 必选 内容
'post_category': 1, # 可选 分类
'post_status': 'draft'
}
r = requests.post(url=api, data=from_data)
print(r.text)
if __name__ == '__main__':
wp_post(conten)
以上就是通过火车头的免登api发布内容到wp网站。