mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-12 05:08:28 +03:00
reduce s3 duplicating while keeping random urls via hash (#112)
This commit is contained in:
committed by
GitHub
parent
9ee323a654
commit
3e56ef137d
@@ -1,5 +1,6 @@
|
||||
|
||||
import os, json, requests
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from loguru import logger
|
||||
|
||||
@@ -49,3 +50,7 @@ def update_nested_dict(dictionary, update_dict):
|
||||
update_nested_dict(dictionary[key], value)
|
||||
else:
|
||||
dictionary[key] = value
|
||||
|
||||
def random_str(length: int = 32) -> str:
|
||||
assert length <= 32, "length must be less than 32 as UUID4 is used"
|
||||
return str(uuid.uuid4()).replace("-", "")[:length]
|
||||
Reference in New Issue
Block a user