class CaptureString(Protocol):

    def dataReceived(self, data):
        print(('Received:', data))

def connectionLost(self, reason):
    pass
Twisted Python How To Create a twisted.web.client.BrowserLikePolicyForHTTPS with a custom trustRoot?