Commit e1bb4995 authored by Fence's avatar Fence 🌈

add gen_listen_jwt script

parent 443c8b02
import sys
import jwt
from datetime import datetime, timedelta
expires = 15
payload = {"song": "5b9ae72fc0368e3b9c8a6027" }
key = None
with open(sys.argv[2], "r") as file:
key = file.read()
payload["iss"] = sys.argv[1]
payload["iat"] = datetime.utcnow()
payload["exp"] = datetime.utcnow() + timedelta(expires)
payload["song"] = sys.argv[3]
print(jwt.encode(payload, key, algorithm='RS256'))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment