File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 10
10
#
11
11
import asyncio
12
12
import email
13
+ import hashlib
13
14
import itertools
14
15
import os
15
16
import pathlib
@@ -1678,6 +1679,9 @@ class Cache:
1678
1679
def __attrs_post_init__ (self ):
1679
1680
os .makedirs (self .directory , exist_ok = True )
1680
1681
1682
+ def sha256_hash (self , text : str ) -> str :
1683
+ return hashlib .sha256 (text .encode ()).hexdigest ()
1684
+
1681
1685
async def get (
1682
1686
self ,
1683
1687
credentials ,
@@ -1693,7 +1697,7 @@ async def get(
1693
1697
True otherwise as treat as binary. `path_or_url` can be a path or a URL
1694
1698
to a file.
1695
1699
"""
1696
- cache_key = quote_plus (path_or_url .strip ("/" ))
1700
+ cache_key = self . sha256_hash ( quote_plus (path_or_url .strip ("/" ) ))
1697
1701
cached = os .path .join (self .directory , cache_key )
1698
1702
1699
1703
if force or not os .path .exists (cached ):
You can’t perform that action at this time.
0 commit comments