def _getReq(self, resource=None):
        """
        Create a request object with a stub channel and install the
        passed resource at /newrender. If no resource is passed,
        create one.
        """
        d = DummyChannel()
        if resource is None:
            resource = NewRenderResource()
        d.site.resource.putChild(b'newrender', resource)
        d.transport.port = 81
        request = server.Request(d, 1)
        request.setHost(b'example.com', 81)
        request.gotLength(0)
        return request

        Create a request object with a stub channel and install the
        passed resource at /newrender. If no resource is passed,
        create one.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_web.py