Note that there are some explanatory texts on larger screens.

plurals
  1. POpywikipedia bot with https and http authentication
    primarykey
    data
    text
    <p>I'm having trouble getting my bot to login to a MediaWiki install on the intranet. I believe it is due to the http authentication protecting the wiki. </p> <p>Facts:</p> <ol> <li>The wiki root is: <a href="https://local.example.com/mywiki/" rel="nofollow noreferrer">https://local.example.com/mywiki/</a></li> <li>When visiting the wiki with a web browser, a popup comes up asking for enterprise credentials (I assume this is basic access authentication) </li> </ol> <p>This is what I have in my user-config.py:</p> <pre><code>mylang = 'en' family = 'mywiki' usernames['mywiki']['en'] = u'Bot' authenticate['local.example.com'] = ('user', 'pass') </code></pre> <p>This is what I have in mywiki_family.py:</p> <pre><code># -*- coding: utf-8 -*- import family, config # The Wikimedia family that is known as mywiki class Family(family.Family): def __init__(self): family.Family.__init__(self) self.name = 'mywiki' self.langs = { 'en' : 'local.example.com'} def scriptpath(self, code): return '/mywiki' def version(self, code): return '1.13.5' def isPublic(self): return False def hostname(self, code): return 'local.example.com' def protocol(self, code): return 'https' def path(self, code): return '/mywiki/index.php' </code></pre> <p>When I execute login.py -v -v, I get this:</p> <pre><code>urllib2.urlopen(urllib2.Request('https://local.example.com/w/index.php?title=Special:Userlogin&amp;useskin=monobook&amp;action=submit', wpSkipCookieCheck=1&amp;wpPassword=XXXX&amp;wpDomain=&amp;wpRemember=1&amp;wpLoginattempt=Aanmelden%20%26%20Inschrijven&amp;wpName=Bot, {'Content-type': 'application/x-www-form-urlencoded', 'User-agent': 'PythonWikipediaBot/1.0'})): (Redundant traceback info here) urllib2.HTTPError: HTTP Error 401: Unauthorized </code></pre> <p>(I'm not sure why it has 'local.example.com/w' instead of '/mywiki'.)</p> <p>I thought it might be trying to authenticate to example.com instead of example.com/wiki, so I changed the authenticate line to:</p> <pre><code>authenticate['local.example.com/mywiki'] = ('user', 'pass') </code></pre> <p>But then I get an HTTP 401.2 error back from IIS:</p> <blockquote> <p>You do not have permission to view this directory or page using the credentials that you supplied because your Web browser is sending a WWW-Authenticate header field that the Web server is not configured to accept.</p> </blockquote> <p>Any help on how to get this working would be appreciated.</p> <p><strong>Update</strong> After fixing my family file, it now says:</p> <blockquote> <p>Getting information for site mywiki:en ('http error', 401, 'Unauthorized', ) WARNING: Could not open '<a href="https://local.example.com/mywiki/index.php?title=Non-existing_page&amp;action=edit&amp;useskin=monobook" rel="nofollow noreferrer">https://local.example.com/mywiki/index.php?title=Non-existing_page&amp;action=edit&amp;useskin=monobook</a>'. Maybe the server or your connection is down. Retrying in 1 minutes...</p> </blockquote> <p>I looked at the HTTP headers on a plan urllib2.ulropen call and it's using WWW-Authenticate: Negotiate WWW-Authenticate: NTLM. I'm guessing urllib2 and thus pywikipedia don't support this?</p> <p><strong>Update</strong> Added a tasty bounty for help in getting this to work. I can authenticate using python-ntlm. How do I integrate this into pywikipedia?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload