Hi,
no more mod-rewrite rules ;)! It has an issue with adding/removing
pages to the book and in my opinion it is a little bit dirty way.

The final solution is to improve python mwlib code. I wish someone of
mwlib contributors would do this, including all the consequences. The
change is based on example written bellow and I have had to make
changes (in my case) in these files:
/usr/lib64/python2.4/site-packages/mwlib/net/mwapi.py and pod.py.
Search and improve the code where the method client.getPage() is
called.

The next python example fetch wiki page secured by Apache AuthType
Basic.
[mi...@bilbo5 ~]$ python webcatmwhttps.py https://wiki.bilbo5.praha.tmapy.cz

Source code:
[mi...@bilbo5 ~]$ cat webcatmwhttps.py
from twisted.web import client, error as weberror
from twisted.internet import reactor
import sys, getpass, base64

def printPage(data):
    print data
    reactor.stop()

def checkHTTPError(failure, url):
    failure.trap(weberror.Error)
    if failure.value.status == '401':
        print >> sys.stderr, failure.getErrorMessage()
        #promp for username and password
        username = "yourusername"
        password = "yourpassword"
        basicAuth = base64.encodestring("%s:%s" % (username,
password))
        authHeader = "Basic " + basicAuth.strip()
        #try to fetch the page again with authentication
        return client.getPage(
            url, headers={"Authorization": authHeader})
    else:
        return failure

def printError(failure):
    print >> sys.stderr, "Error:", failure.getErrorMessage()
    reactor.stop()

if len(sys.argv) == 2:
    url = sys.argv[1]
    client.getPage(url).addErrback(
        checkHTTPError, url).addCallback(
        printPage).addErrback(
        printError)
    reactor.run()
else:
    print "Usage: %s <URL>" % sys.argv[0]


-- 
You received this message because you are subscribed to the Google Groups 
"mwlib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/mwlib?hl=en.

Reply via email to