首页 > 解决方案 > 无法通过 Confluence 服务器对 Sphinx 文档进行身份验证

问题描述

我正在使用 sphinx 在 confluence 中构建文档。我可以使用 sphinx 制作 html 文件。但是当我尝试使用“make confluence”命令连接融合时,它会引发错误

我通过更改 confluence 密码进行了检查,并使用 API 令牌进行了检查,仍然出现错误并且无法连接到 confluence。

参考链接- https://github.com/Shravankumarhiregoudar/sphinxDocumentation

conf.py 文件:

# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.append('/home/4px/sphinx/scripts/')


# -- Project information -----------------------------------------------------

project = 'sites'
copyright = '2021, divyank'
author = 'divyank'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.intersphinx',
    'sphinx.ext.ifconfig',
    'sphinx.ext.viewcode',
    'sphinx.ext.githubpages',
    'sphinxcontrib.confluencebuilder'
]
confluence_publish = True
confluence_space_name = 'Documentation'
##confluence_ask_password = True
#confluence_parent_name = 'API Documentation'
# (for Confluence Cloud)
confluence_server_url = 'https://<....>.atlassian.net/wiki/spaces'
confluence_server_user = '<....>'
confluence_server_pass = '<.......>'
# (or, for Confluence Server)
#confluence_server_url = 'https://intranet-wiki.example.com/'
#confluence_server_user = 'myawesomeuser'

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns=[]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = 'default'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
    'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
    'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
    'preamble': '',
# Latex figure (float) alignment
    'figure_align': 'htbp',
}

错误:

WARNING: normalizing confluence url from https://<......>.atlassian.net/wiki/ to https://<.......>.atlassian.net/wiki/

sphinxcontrib.confluencebuilder error:
---
Unable to authenticate with the Confluence server.

Ensure your username and password are correct. If your username and password is correct, you may need to unlock your Confluence account be re-logging in with your browser or asking your Confluence administrator for help.
---

make: *** [confluence] Error 2

标签: python-sphinxconfluencedocumentation-generation

解决方案


我可以在 conf.py 文件的 confluence 密码字段中使用 API 令牌来解决这个问题。

如何生成 API 令牌 - 为您的 Atlassian 帐户管理 API 令牌

参考链接-

无法使用 sphinxcontrib.confluencebuilder 向 Confluence 服务器进行身份验证


推荐阅读