def post(self, user, title, content): client = DiscourseClient( 'https://community.bigquant.com/', api_username=user, api_key= 'ceaa79d2386bfbe83cdd1b71f6e7be3861c26dfb9d1c1982614aed7176db03a8') for i in range(0, 3): try: client.create_post(content=content, category=u"AI量化百科", skip_validations=True, auto_track=False, title=title) path = self._posted_path(title) print(title, path) with codecs.open(path, 'w', 'utf-8') as writer: writer.write(title + '\n') writer.write('\n\n') writer.write(content) return except Exception as e: print(e) print(exception_trace(single_line=False)) time.sleep(1 << i)