import urllib.request
import json
import jwt

token = jwt.encode({'public_id': 'superadmin', 'role': 'superadmin', 'institute_id': 1}, 'MySecret', algorithm="HS256")

try:
    req = urllib.request.Request('http://127.0.0.1:30015/api/admin/templates', headers={'x-access-token': token})
    with urllib.request.urlopen(req) as response:
        print(response.read().decode())
except urllib.error.HTTPError as e:
    print(f"HTTP Error: {e.code}")
    print(e.read().decode())
