Thanks. I had actually already found your page and you&#39;re right, it does seem to be the best resource out there. Since your email I&#39;ve had a second look at it, as initially I wasn&#39;t sure how to use the example to return a web resource (handler with render_GET etc) in place of the file you returned. Turns out it wasn&#39;t actually too bad, and looks something like:<br>
<br>{code}<br><pre>from zope.interface import implements<br><br>from twisted.cred.portal import IRealm, Portal<br>from twisted.cred.checkers import FilePasswordDB<br>from twisted.web.static import File<br>from twisted.web.resource import IResource<br>
from twisted.web.guard import HTTPAuthSessionWrapper, DigestCredentialFactory<br><br>def secureServer():<br>    class PublicHTMLRealm(object):<br>        implements(IRealm)<br><br>        def requestAvatar(self, avatarId, mind, *interfaces):<br>
            if IResource in interfaces:<br>                return (IResource, WebResource(), lambda: None)<br>            raise NotImplementedError()<br><br>    portal = Portal(PublicHTMLRealm(), [FilePasswordDB(&#39;httpd.password&#39;)])<br>
<br>    credentialFactory = BasicCredentialFactory(&quot;MyRealm&quot;)<br>    rsrc = HTTPAuthSessionWrapper(portal, [credentialFactory])<br><br>    return rsrc<br><br>class WebResource(resource.Resource):<br>    def __init__():<br>
        ....<br><br>    def getChild(self, path, request):<br>        if path == self.expected:<br>            return ValidHandler()<br>        else:<br>            return InvalidUrlHandler()<br><br># Create server<br>my_server = secureServer(...)<br>
site = server.Site(my_server)<br></pre>{code}<br><br>This has worked great so far where ValidHandler contains a render_GET, but when calling a POST or PUT on handler that has render_POST or render_PUT using this technique returns a message which I think is Method Not Allowed (on the train right now, so don&#39;t have in front of me, sorry). Is there a better way to form the above to prevent this?<br>
<br>Thanks again<br>Brad<br><br><div class="gmail_quote">On 9 February 2010 10:02,  <span dir="ltr">&lt;<a href="mailto:exarkun@twistedmatrix.com">exarkun@twistedmatrix.com</a>&gt;</span> wrote:<br>...<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
It&#39;s definitely true that there isn&#39;t a lot of documentation for Guard. I&#39;ve written up something, though (which hopefully will soon be included in Twisted itself, to make it easier to find), which I think will get you up to speed on using Guard pretty quickly:<br>

<br>
   <a href="http://jcalderone.livejournal.com/53074.html" target="_blank">http://jcalderone.livejournal.com/53074.html</a><br>
<br>
The final example, which sets up an actual Twisted Web server protected by digest auth (basic is even easier), only takes 16 lines.<br>
<br>
If that&#39;s still not to your liking, then you can always fall back to the much more tedious, much less elegant, request.getUsername() and request.getPassword() approach. :)  You&#39;ll have to rely on the API docs for that approach, though, as far as I know there are no prose-style introductions for it.<br>
</blockquote><div>... <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Jean-Paul<br>
<br>
<br>_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
<br></blockquote></div><br>