Update hash method
This commit is contained in:
parent
0e627eae72
commit
1139c406fb
2 changed files with 3 additions and 2 deletions
|
@ -48,8 +48,9 @@ async def hash(
|
||||||
Hash an object.
|
Hash an object.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
hash_func: Hash function, default `hashlib.sha256`
|
|
||||||
data: URL or text to hash
|
data: URL or text to hash
|
||||||
|
method: Hash function/function name, default `hashlib.sha256`
|
||||||
|
size: Blocksize, default `8 MB`
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Tuple of hash hex, data size, and content type
|
Tuple of hash hex, data size, and content type
|
||||||
|
|
|
@ -24,4 +24,4 @@ async def get_size(link: str) -> int:
|
||||||
async with ClientSession() as session:
|
async with ClientSession() as session:
|
||||||
resp = await session.get(link)
|
resp = await session.get(link)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
return resp.content_length
|
return resp.content_length or -1
|
||||||
|
|
Loading…
Add table
Reference in a new issue