Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class _HashSumProtocol(Protocol):
def __init__(self, kind='sha256'):
self._hash = hashlib.new(kind)
def dataReceived(self, data):
self.bytes_received += len(data)
self._hash.update(data)
@meejah

This comment has been minimized.

Copy link
Owner Author

meejah commented Jun 5, 2017

then you'd do something like this with a twisted.web.client Agent:

        resp = yield agent.request('GET', uri)
        hasher = _HashSumProtocol()
        resp.deliverBody(hasher)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.