Open lopins opened 10 months ago
php Server: (request: "POST /xmlrpc.php") executing too slow
Python Code:
def post_data_wordpress(self): web = self.site_parms["web_config"][0] try: client = Client(f'{web["web_domain"]}/xmlrpc.php', web["web_username"], web["web_password"]) all_posts = [] # 检查是否存在给定标题的文章 if len(all_posts) > 0 and any(_.title == self.article_info['title'] for _ in all_posts): return { "title": self.article_info["title"], "source": self.article_info["source"], "tags": self.article_info["tags"], "baidu": list(), "status": "已经存在,跳过发布" } else: post = WordPressPost() post.title = self.article_info["title"] post.content = self.article_info["content"] post.terms_names = { 'post_tag': self.article_info["tags"], 'category': self.article_info["category"] } post.slug = self.chinese_url_slug() post.post_status = 'publish' try: post_id = client.call(NewPost(post)) status = f'新增文章,发布成功' except Exception as e: if str(e) == 'junk after document element: line 1, column 240': status = f'新增文章,发布成功' else: status = f'XML-RPC其他原因失败,异常情况:{str(e)}' return { "title": self.article_info["title"], "source": self.article_info["source"], "tags": self.article_info["tags"], "status": status } except Exception as e: logger.info(f'XML-RPC其他原因失败,异常情况:{str(e)}')
php Server: (request: "POST /xmlrpc.php") executing too slow
Python Code: