我想使用 mwclient 来编辑 HTTPS 后面的内部 wiki。 此页面建议您可以像这样传入主机元组:
站点 = mwclient.Site(('https','wiki.whatever.com'))
但是我看不到如何使用 Apache 进行身份验证。您是否需要设置带有身份验证的 urllib2 开启程序处理程序?
也欢迎使用 python-wikitools 的解决方案,但也缺少 https 示例。
更新:也许它使用与您登录 wiki 时相同的用户 ID 和密码?不过,在这种情况下我仍然会遇到错误:
Traceback (most recent call last): File "C:\ddc\DDC_Toolbox\python_root\apps\create_new_project\trunk\create_new_project.py", line 36, in <module> site = mwclient.Site(('https',url)) File "C:\bin\Python27\lib\site-packages\mwclient-0.6.5-py2.7.egg\mwclient\client.py", line 92, in __init__ self.site_init() File "C:\bin\Python27\lib\site-packages\mwclient-0.6.5-py2.7.egg\mwclient\client.py", line 100, in site_init siprop = 'general|namespaces', uiprop = 'groups|rights') File "C:\bin\Python27\lib\site-packages\mwclient-0.6.5-py2.7.egg\mwclient\client.py", line 165, in api info = self.raw_api(action, **kwargs) File "C:\bin\Python27\lib\site-packages\mwclient-0.6.5-py2.7.egg\mwclient\client.py", line 248, in raw_api json_data = self.raw_call('api', data).read() File "C:\bin\Python27\lib\site-packages\mwclient-0.6.5-py2.7.egg\mwclient\client.py", line 223, in raw_call url, data = data, headers = headers) File "C:\bin\Python27\lib\site-packages\mwclient-0.6.5-py2.7.egg\mwclient\http.py", line 226, in post path, headers, data) File "C:\bin\Python27\lib\site-packages\mwclient-0.6.5-py2.7.egg\mwclient\http.py", line 161, in post return self.request('POST', host, path, headers, data) File "C:\bin\Python27\lib\site-packages\mwclient-0.6.5-py2.7.egg\mwclient\http.py", line 152, in request raise errors.HTTPStatusError, (res.status, res) mwclient.errors.HTTPStatusError: (401, <httplib.HTTPResponse instance at 0x0241C0D0>)