使用NodeBB API创建帖子主题和回复
API的调用地址:
通过 /api/v3/topics/
API使用Python的requests
库创建一个主题
data = { "cid": int(cid), "title": entry.title, "content": '\n'.join(description), "tags": tags } headers = {'Authorization': 'Bearer {token}'.format(token=os.environ.get('NODEBB_TOKEN'))} url = '{host}/api/v3/topics/'.format(host=os.environ.get('NODEBB_URL')) response = requests.post( url=url, headers=headers, json=data ) response.raise_for_status()