Spaces:
Sleeping
Sleeping
| 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) |