GodsDevProject's picture
Upload 20 files
5830944 verified
raw
history blame contribute delete
300 Bytes
import json, hashlib, time
_STORE = {}
def save_search(query, sources):
payload = {"q": query, "s": sources, "t": int(time.time())}
key = hashlib.sha256(json.dumps(payload).encode()).hexdigest()[:12]
_STORE[key] = payload
return key
def load_search(key):
return _STORE.get(key)