Z230
This commit is contained in:
87
Testy/11 Testy.py
Normal file
87
Testy/11 Testy.py
Normal file
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import json
|
||||
import requests
|
||||
from pathlib import Path
|
||||
|
||||
TOKEN_PATH = Path("token.txt")
|
||||
GRAPHQL_URL = "https://api.medevio.cz/graphql"
|
||||
CLINIC_SLUG = "mudr-buzalkova"
|
||||
|
||||
QUERY = r"""
|
||||
query ClinicLegacyRequestList_ListPatientRequestsForClinic(
|
||||
$clinicSlug: String!,
|
||||
$queueId: String,
|
||||
$queueAssignment: QueueAssignmentFilter!,
|
||||
$state: PatientRequestState,
|
||||
$pageInfo: PageInfo!,
|
||||
$locale: Locale!
|
||||
) {
|
||||
requests: listPatientRequestsForClinic(
|
||||
clinicSlug: $clinicSlug
|
||||
queueId: $queueId
|
||||
queueAssignment: $queueAssignment
|
||||
state: $state
|
||||
pageInfo: $pageInfo
|
||||
) {
|
||||
id
|
||||
displayTitle(locale: $locale)
|
||||
createdAt
|
||||
doneAt
|
||||
removedAt
|
||||
extendedPatient {
|
||||
name
|
||||
surname
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
def main():
|
||||
token = TOKEN_PATH.read_text().strip()
|
||||
|
||||
headers = {
|
||||
"Authorization": f"Bearer {token}",
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json",
|
||||
}
|
||||
|
||||
variables = {
|
||||
"clinicSlug": CLINIC_SLUG,
|
||||
"queueId": None,
|
||||
"queueAssignment": "ANY",
|
||||
"state": "ACTIVE",
|
||||
"pageInfo": {"first": 200, "offset": 100},
|
||||
"locale": "cs",
|
||||
}
|
||||
|
||||
print("⏳ Testing ACTIVE request fetch (LEGACY API)…")
|
||||
|
||||
r = requests.post(
|
||||
GRAPHQL_URL,
|
||||
json={"query": QUERY, "variables": variables},
|
||||
headers=headers,
|
||||
timeout=30
|
||||
)
|
||||
r.raise_for_status()
|
||||
|
||||
js = r.json()
|
||||
|
||||
# extract list
|
||||
requests_list = js.get("data", {}).get("requests", [])
|
||||
|
||||
print("\n📌 Number of ACTIVE requests returned:", len(requests_list))
|
||||
|
||||
print("\n📌 First 5 request IDs:")
|
||||
for item in requests_list[:5]:
|
||||
print(" •", item.get("id"))
|
||||
|
||||
# debug dump if needed
|
||||
# print(json.dumps(js, indent=2, ensure_ascii=False))
|
||||
|
||||
print("\n✅ Test completed.\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user