#!/usr/bin/env python3
"""Introspect the LoginPage enum on authentication.curogram.com/graphql."""
import json, urllib.request, urllib.error
EP = "https://authentication.curogram.com/graphql"
Q = ('query I { __type(name: "LoginPage") { name kind enumValues { name } } }')
body = json.dumps({"operationName": "I", "query": Q, "variables": {}}).encode()
req = urllib.request.Request(EP, data=body, method="POST", headers={
    "Content-Type": "application/json", "Accept": "application/json",
    "X-Curogram-Frontend": "web"})
try:
    with urllib.request.urlopen(req, timeout=20) as r:
        print(r.status, r.read().decode("utf-8"))
except urllib.error.HTTPError as e:
    print(e.code, e.read().decode("utf-8", "replace")[:500])
