Spaces:
Sleeping
Sleeping
Download utils/jwt.py from ByteRiot/CandidateExplorer: direct link, hf CLI and curl.
- Browser
- Download file 461 Bytes
-
https://huggingface.co/spaces/ByteRiot/CandidateExplorer/resolve/main/utils/jwt.py
- Command line
-
hf download hf://spaces/ByteRiot/CandidateExplorer/utils/jwt.py
-
curl -L -o jwt.py https://huggingface.co/spaces/ByteRiot/CandidateExplorer/resolve/main/utils/jwt.py
461 Bytes
| from config.constant import SecurityConstants | |
| from datetime import datetime, timedelta | |
| from jose import jwt | |
| def create_access_token(data: dict) -> str: | |
| to_encode = data.copy() | |
| expire = datetime.now() + timedelta( | |
| minutes=SecurityConstants.JWT_EXPIRE_MINUTES | |
| ) | |
| to_encode.update({"exp": expire}) | |
| return jwt.encode( | |
| to_encode, | |
| SecurityConstants.JWT_SECRET_KEY, | |
| algorithm=SecurityConstants.JWT_ALGORITHM, | |
| ) |