notebook
This commit is contained in:
112
Testy/05 Testy.py
Normal file
112
Testy/05 Testy.py
Normal file
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import json
|
||||
import requests
|
||||
from pathlib import Path
|
||||
|
||||
TOKEN_PATH = Path("token.txt")
|
||||
CLINIC_SLUG = "mudr-buzalkova"
|
||||
|
||||
GRAPHQL_URL = "https://api.medevio.cz/graphql" # ← správná URL
|
||||
|
||||
# 👉 nastav offset zde
|
||||
OFFSET = 0 # 0 = první pacient, 1 = druhý, 100 = 101. pacient
|
||||
FIRST = 1 # načteme jen jednoho
|
||||
|
||||
QUERY = """
|
||||
query PatientGridImpl_ListClinicPatients(
|
||||
$clinicSlug: String!,
|
||||
$filter: ListPatientFilter!,
|
||||
$pageInfo: PageInfo!,
|
||||
$sort: [ListPatientsSort!]
|
||||
) {
|
||||
patientsList: listPatients(
|
||||
clinicSlug: $clinicSlug
|
||||
filter: $filter
|
||||
pageInfo: $pageInfo
|
||||
sort: $sort
|
||||
) {
|
||||
count
|
||||
patients {
|
||||
id
|
||||
identificationNumber
|
||||
insuranceCompanyObject {
|
||||
id
|
||||
shortName
|
||||
}
|
||||
lastReservation
|
||||
locale
|
||||
name
|
||||
nextReservation
|
||||
key
|
||||
phone
|
||||
sex
|
||||
status2
|
||||
surname
|
||||
type
|
||||
kind
|
||||
isInClinic
|
||||
isUnknownPatient
|
||||
user {
|
||||
id
|
||||
name
|
||||
surname
|
||||
phone
|
||||
registrationCompletedTime
|
||||
}
|
||||
owner {
|
||||
name
|
||||
surname
|
||||
}
|
||||
clinics {
|
||||
id
|
||||
name
|
||||
slug
|
||||
}
|
||||
tags(onlyImportant: false) {
|
||||
id
|
||||
name
|
||||
color
|
||||
icon
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
variables = {
|
||||
"clinicSlug": CLINIC_SLUG,
|
||||
"filter": {},
|
||||
"pageInfo": {
|
||||
"first": FIRST,
|
||||
"offset": OFFSET
|
||||
},
|
||||
"sort": [
|
||||
{
|
||||
"field": "ReverseFullName",
|
||||
"sort": "ASC"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
token = Path("token.txt").read_text().strip()
|
||||
|
||||
headers = {
|
||||
"Authorization": f"Bearer {token}",
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json",
|
||||
}
|
||||
|
||||
print("⏳ Fetching patient...")
|
||||
response = requests.post(
|
||||
GRAPHQL_URL,
|
||||
json={"query": QUERY, "variables": variables},
|
||||
headers=headers
|
||||
)
|
||||
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
|
||||
print("\n📌 RAW JSON RESPONSE:\n")
|
||||
print(json.dumps(data, indent=2, ensure_ascii=False))
|
||||
Reference in New Issue
Block a user