45 lines
1.0 KiB
Python
45 lines
1.0 KiB
Python
import json, requests
|
|
|
|
GRAPHQL_URL = "https://api.medevio.cz/graphql"
|
|
|
|
FULL_INTROSPECTION_QUERY = """
|
|
query IntrospectionQuery {
|
|
__schema {
|
|
queryType { name }
|
|
mutationType { name }
|
|
subscriptionType { name }
|
|
types {
|
|
...FullType
|
|
}
|
|
}
|
|
}
|
|
fragment FullType on __Type {
|
|
kind
|
|
name
|
|
fields(includeDeprecated: true) {
|
|
name
|
|
}
|
|
}
|
|
"""
|
|
|
|
headers = {
|
|
"content-type": "application/json",
|
|
"origin": "https://my.medevio.cz",
|
|
"referer": "https://my.medevio.cz/",
|
|
}
|
|
|
|
# Load cookies from storage
|
|
state = json.load(open("medevio_storage.json", encoding="utf-8"))
|
|
cookies = {c["name"]: c["value"] for c in state["cookies"] if "medevio" in c["domain"]}
|
|
|
|
payload = {"operationName": "IntrospectionQuery", "query": FULL_INTROSPECTION_QUERY}
|
|
|
|
r = requests.post(GRAPHQL_URL, headers=headers, cookies=cookies, data=json.dumps(payload))
|
|
print("Status:", r.status_code)
|
|
try:
|
|
data = r.json()
|
|
print(json.dumps(data, indent=2, ensure_ascii=False)[:2000])
|
|
except Exception as e:
|
|
print("Could not decode response:", e)
|
|
print(r.text)
|