Spaces:
Sleeping
Sleeping
Download core/time_utils.py from Brainw/UdemyScout: direct link, hf CLI and curl.
- Browser
- Download file 342 Bytes
-
https://huggingface.co/spaces/Brainw/UdemyScout/resolve/main/core/time_utils.py
- Command line
-
hf download hf://spaces/Brainw/UdemyScout/core/time_utils.py
-
curl -L -o time_utils.py https://huggingface.co/spaces/Brainw/UdemyScout/resolve/main/core/time_utils.py
342 Bytes
| from datetime import datetime, timedelta | |
| def get_expiry_status(expiry): | |
| exp = datetime.fromisoformat(expiry) | |
| rem = exp - datetime.utcnow() | |
| if rem.total_seconds() <= 0: return "🔴 Expired" | |
| if rem <= timedelta(hours=6): return "🔴 Expiring Soon" | |
| if rem <= timedelta(hours=24): return "🟠 <24h" | |
| return "🟢 Active" |