代码:
import requests from http import client from wordpress_xmlrpc import Client, WordPressPost from wordpress_xmlrpc.methods.posts import GetPosts from wordpress_xmlrpc.methods import posts from wordpress_xmlrpc import WordPressTerm from wordpress_xmlrpc.methods import taxonomies def Baidu_API_Submit(url): headers = { 'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Accept-Encoding':'gzip, deflate, br', 'Accept-Language':'zh-CN,zh;q=0.9,en;q=0.8', 'Cache-Control':'max-age=0', 'Connection':'keep-alive', 'Cookie':'', 'Host':'data.zz.baidu.com', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'curl/7.12.1', } baiduurl = 'http://data.zz.baidu.com/urls?site=https://www.xxxx.net&token=xxxx' response = requests.post(baiduurl,data=url,headers=headers) return (response.text) wp = Client('https://www.xacisco.net/blog/xmlrpc.php', 'xxxx', 'xxx') allposts=wp.call(GetPosts({'post_type': 'post', 'number': 500})) for thepost in allposts: print (thepost.id,thepost.title,thepost.link) print(Baidu_API_Submit(thepost.link))