I am trying to understand how it works in the context of twisted.web and Resources, but I always get an exception on the portal object<div>Here is the core code:</div><div><br></div><div><div>    passwords = {&quot;admin&quot;:&quot;password&quot;}</div>
<div>    users = {&quot;admin&quot;:&quot;Administrator&quot;}</div><div>    </div><div>    realm = TestRealm(users)</div><div>    </div><div>    p = portal.Portal(TestRealm(users),(PasswordDictChecker(passwords),))</div>
<div>    credentialFactory = BasicCredentialFactory(&quot;CorePost&quot;)</div><div>    resource = HTTPAuthSessionWrapper(portal, [credentialFactory])</div><div>    </div><div>    print &quot;Running...&quot;</div><div>    </div>
<div>    factory = Site(resource)</div><div>    reactor.listenTCP(8084, factory)    </div><div>    reactor.run() </div></div><div><br></div><div>Error:</div><div><br></div><div><div>Unhandled Error</div><div>Traceback (most recent call last):</div>
<div>  File &quot;/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/protocols/basic.py&quot;, line 564, in dataReceived</div><div>    why = self.lineReceived(line)</div><div>  File &quot;/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/http.py&quot;, line 1551, in lineReceived</div>
<div>    self.allContentReceived()</div><div>  File &quot;/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/http.py&quot;, line 1618, in allContentReceived</div><div>    req.requestReceived(command, path, version)</div>
<div>  File &quot;/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/http.py&quot;, line 773, in requestReceived</div><div>    self.process()</div><div>--- &lt;exception caught here&gt; ---</div>
<div>  File &quot;/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/server.py&quot;, line 131, in process</div><div>    resrc = self.site.getResourceFor(self)</div><div>  File &quot;/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/server.py&quot;, line 562, in getResourceFor</div>
<div>    return resource.getChildForRequest(self.resource, request)</div><div>  File &quot;/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/resource.py&quot;, line 65, in getChildForRequest</div>
<div>    resource = resource.getChildWithDefault(pathElement, request)</div><div>  File &quot;/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/_auth/wrapper.py&quot;, line 142, in getChildWithDefault</div>
<div>    return self._authorizedResource(request)</div><div>  File &quot;/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/_auth/wrapper.py&quot;, line 106, in _authorizedResource</div>
<div>    return util.DeferredResource(self._login(Anonymous()))</div><div>  File &quot;/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/_auth/wrapper.py&quot;, line 152, in _login</div>
<div>    d = self._portal.login(credentials, None, IResource)</div><div><b>exceptions.AttributeError: &#39;module&#39; object has no attribute &#39;login&#39;</b></div></div><div><b><br></b></div><div>Attached the full file.</div>
<div><br></div><div>Not sure I understand what I am doing right here. The app starts up fine, but throws the error on any request.</div><div>Also, how do I hook up actual Resources?</div><div>Do I do it do the HttpAuthSessionWrapper? It is an IResources, but complains that it does not have a putChild() on it?</div>
<div>Should my TestRealm extend a Resource and I add my child Resource there?</div><div><br></div><div>Sorry for all the questions, but the docs don&#39;t really cover the A-Z scenario of getting a running twisted.web app with Http auth... :-(</div>
<div><br></div><div>Jacek</div>