Update hash method
This commit is contained in:
parent
98978dd5b9
commit
c64cc86f8d
1 changed files with 7 additions and 1 deletions
|
@ -98,9 +98,15 @@ async def hash(
|
||||||
resp = await session.get(data)
|
resp = await session.get(data)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
content_type = resp.content_type
|
content_type = resp.content_type
|
||||||
data_len = resp.content_length
|
|
||||||
|
# While we could use resp.content_length, that sometimes returns None,
|
||||||
|
# so we manually count the size while looping.
|
||||||
|
data_len = 0
|
||||||
|
block_count = 0
|
||||||
|
|
||||||
async for block in resp.content.iter_chunked(n=size):
|
async for block in resp.content.iter_chunked(n=size):
|
||||||
|
data_len += len(block)
|
||||||
|
block_count += 1
|
||||||
method.update(block)
|
method.update(block)
|
||||||
|
|
||||||
return method.hexdigest(), data_len, content_type
|
return method.hexdigest(), data_len, content_type
|
||||||
|
|
Loading…
Add table
Reference in a new issue