Centralize token.txt to project root

- Updated 35 scripts to read token.txt from project root
  using Path(__file__).resolve().parent.parent / "token.txt"
- Removed 6 duplicate token.txt files from subdirectories
- Single token.txt in project root serves all scripts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 18:27:38 +01:00
parent 5992a01cdd
commit d783882cf6
42 changed files with 37 additions and 48 deletions
+2 -1
View File
@@ -8,10 +8,11 @@ Reads Bearer token from token.txt (single line, token only).
import requests import requests
import pandas as pd import pandas as pd
import time import time
from pathlib import Path
from typing import List, Dict, Any from typing import List, Dict, Any
# CONFIG --------------------------------------------------------------------- # CONFIG ---------------------------------------------------------------------
TOKEN_FILE = "token.txt" # file with token (no "Bearer " prefix) TOKEN_FILE = str(Path(__file__).resolve().parent.parent / "token.txt") # centralized token
GRAPHQL_URL = "https://app.medevio.cz/graphql" GRAPHQL_URL = "https://app.medevio.cz/graphql"
CLINIC_SLUG = "mudr-buzalkova" # adjust if needed CLINIC_SLUG = "mudr-buzalkova" # adjust if needed
LOCALE = "cs" LOCALE = "cs"
+1 -1
View File
@@ -6,7 +6,7 @@ from pathlib import Path
import requests # 👈 this is new import requests # 👈 this is new
# --- Settings ---------------------------------------------------- # --- Settings ----------------------------------------------------
TOKEN_PATH = Path("token.txt") # file contains ONLY the token, no "Bearer " TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
SHOW_FULL_TOKEN = False # set True if you want to print the full token SHOW_FULL_TOKEN = False # set True if you want to print the full token
# ----------------------------------------------------------------- # -----------------------------------------------------------------
+1 -1
View File
@@ -6,7 +6,7 @@ from pathlib import Path
import requests import requests
# --- Settings ---------------------------------------------------- # --- Settings ----------------------------------------------------
TOKEN_PATH = Path("token.txt") # file contains ONLY the token, no "Bearer " TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
# ----------------------------------------------------------------- # -----------------------------------------------------------------
+1 -1
View File
@@ -5,7 +5,7 @@ import json
from pathlib import Path from pathlib import Path
import requests import requests
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
# --- Try including `updatedAt` field directly --- # --- Try including `updatedAt` field directly ---
+1 -1
View File
@@ -5,7 +5,7 @@ import json
from pathlib import Path from pathlib import Path
import requests import requests
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
GRAPHQL_QUERY = r""" GRAPHQL_QUERY = r"""
@@ -11,7 +11,7 @@ from datetime import datetime
# ================================ # ================================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ================================ # ================================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 100 BATCH_SIZE = 100
STATES = ["ACTIVE", "DONE"] # optionally add "REMOVED" STATES = ["ACTIVE", "DONE"] # optionally add "REMOVED"
@@ -11,7 +11,7 @@ from datetime import datetime
# ================================ # ================================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ================================ # ================================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 1000 BATCH_SIZE = 1000
STATES = ["ACTIVE", "DONE"] # optionally add "REMOVED" STATES = ["ACTIVE", "DONE"] # optionally add "REMOVED"
@@ -3,7 +3,7 @@ import json
from pathlib import Path from pathlib import Path
# === Nastavení === # === Nastavení ===
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
REQUEST_ID = "092a0c63-28be-4c6b-ab3b-204e1e2641d4" REQUEST_ID = "092a0c63-28be-4c6b-ab3b-204e1e2641d4"
OUTPUT_DIR = Path(r"u:\Dropbox\!!!Days\Downloads Z230\Medevio_přílohy") OUTPUT_DIR = Path(r"u:\Dropbox\!!!Days\Downloads Z230\Medevio_přílohy")
+1 -1
View File
@@ -2,7 +2,7 @@ import requests
import json import json
from pathlib import Path from pathlib import Path
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
REQUEST_ID = "092a0c63-28be-4c6b-ab3b-204e1e2641d4" REQUEST_ID = "092a0c63-28be-4c6b-ab3b-204e1e2641d4"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
@@ -13,7 +13,7 @@ import shutil
# ============================== # ==============================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ============================== # ==============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
BASE_DIR = Path(r"u:\Dropbox\ordinace\Dokumentace_ke_zpracování\Medevio_přílohy") BASE_DIR = Path(r"u:\Dropbox\ordinace\Dokumentace_ke_zpracování\Medevio_přílohy")
BASE_DIR.mkdir(parents=True, exist_ok=True) BASE_DIR.mkdir(parents=True, exist_ok=True)
@@ -20,7 +20,7 @@ import time
# ============================== # ==============================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ============================== # ==============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
DB_CONFIG = { DB_CONFIG = {
+1 -1
View File
@@ -17,7 +17,7 @@ import time
# ============================== # ==============================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ============================== # ==============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
GRAPHQL_URL = "https://api.medevio.cz/graphql" GRAPHQL_URL = "https://api.medevio.cz/graphql"
DB_CONFIG = { DB_CONFIG = {
+1 -1
View File
@@ -16,7 +16,7 @@ import time
# ============================== # ==============================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ============================== # ==============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
GRAPHQL_URL = "https://api.medevio.cz/graphql" GRAPHQL_URL = "https://api.medevio.cz/graphql"
@@ -10,7 +10,7 @@ import time, socket
# =============================== # ===============================
# ⚙️ CONFIG # ⚙️ CONFIG
# =============================== # ===============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
DB_CONFIG = { DB_CONFIG = {
+1 -1
View File
@@ -10,7 +10,7 @@ import time
# ================================ # ================================
# ⚙️ CONFIGURATION # ⚙️ CONFIGURATION
# ================================ # ================================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 100 BATCH_SIZE = 100
@@ -18,7 +18,7 @@ import time
# ============================== # ==============================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ============================== # ==============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
DB_CONFIG = { DB_CONFIG = {
@@ -23,7 +23,7 @@ except AttributeError:
# ================================ # ================================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ================================ # ================================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 100 BATCH_SIZE = 100
@@ -10,7 +10,7 @@ from dateutil import parser
# ================================ # ================================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ================================ # ================================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
LIMIT = 500 # batch size / number of records LIMIT = 500 # batch size / number of records
+1 -1
View File
@@ -45,7 +45,7 @@ def safe_print(text: str):
# ============================== # ==============================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ============================== # ==============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
GRAPHQL_URL = "https://api.medevio.cz/graphql" GRAPHQL_URL = "https://api.medevio.cz/graphql"
@@ -47,7 +47,7 @@ def safe_print(text: str):
# ============================== # ==============================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ============================== # ==============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
DB_CONFIG = { DB_CONFIG = {
"host": "192.168.1.76", "host": "192.168.1.76",
@@ -40,7 +40,7 @@ def safe_print(text: str):
# ============================== # ==============================
# CONFIG # CONFIG
# ============================== # ==============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
DB_CONFIG = { DB_CONFIG = {
"host": "192.168.1.76", "host": "192.168.1.76",
@@ -48,7 +48,7 @@ def safe_print(text: str):
# ============================== # ==============================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ============================== # ==============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
DB_CONFIG = { DB_CONFIG = {
-1
View File
@@ -1 +0,0 @@
nYvrvgflIKcDiQg8Hhpud+qG8iGZ8eH8su4nyT/Mgcm7XQp65ygY9s39+O01wIpk/7sKd6fBHkiKvsqH
@@ -20,7 +20,7 @@ import time
# ============================== # ==============================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ============================== # ==============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
DB_CONFIG = { DB_CONFIG = {
@@ -35,7 +35,7 @@ def safe_print(text: str):
# ================================ # ================================
# 🔧 CONFIG # 🔧 CONFIG
# ================================ # ================================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 500 BATCH_SIZE = 500
@@ -21,7 +21,7 @@ import argparse
# ============================== # ==============================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ============================== # ==============================
TOKEN_PATH = Path("../10ReadPozadavky/token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
DB_CONFIG = { DB_CONFIG = {
"host": "192.168.1.76", "host": "192.168.1.76",
-1
View File
@@ -1 +0,0 @@
nYvrvgflIKcDiQg8Hhpud+qG8iGZ8eH8su4nyT/Mgcm7XQp65ygY9s39+O01wIpk/7sKd6fBHkiKvsqH
+1 -1
View File
@@ -21,7 +21,7 @@ except AttributeError:
# ================================ # ================================
# 🔧 CONFIGURATION # 🔧 CONFIGURATION
# ================================ # ================================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 100 BATCH_SIZE = 100
+1 -1
View File
@@ -35,7 +35,7 @@ def safe_print(text: str):
# ================================ # ================================
# 🔧 CONFIG # 🔧 CONFIG
# ================================ # ================================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 500 BATCH_SIZE = 500
+1 -1
View File
@@ -41,7 +41,7 @@ def safe_print(text: str):
# ============================== # ==============================
# 🔧 CONFIGURATION (UPDATED TO 192.168.1.50) # 🔧 CONFIGURATION (UPDATED TO 192.168.1.50)
# ============================== # ==============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
GRAPHQL_URL = "https://api.medevio.cz/graphql" GRAPHQL_URL = "https://api.medevio.cz/graphql"
+1 -1
View File
@@ -19,7 +19,7 @@ except AttributeError:
# ============================== # ==============================
# CONFIG (.50) # CONFIG (.50)
# ============================== # ==============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
DB_CONFIG = { DB_CONFIG = {
"host": "192.168.1.50", "host": "192.168.1.50",
+1 -1
View File
@@ -40,7 +40,7 @@ def safe_print(text: str):
# ============================== # ==============================
# 🔧 CONFIGURATION (.50) # 🔧 CONFIGURATION (.50)
# ============================== # ==============================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
DB_CONFIG = { DB_CONFIG = {
-1
View File
@@ -1 +0,0 @@
nYvrvgflIKcDiQg8Hhpud+qG8iGZ8eH8su4nyT/Mgcm7XQp65ygY9s39+O01wIpk/7sKd6fBHkiKvsqH
@@ -13,7 +13,7 @@ except:
# === CONFIG === # === CONFIG ===
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
GRAPHQL_URL = "https://api.medevio.cz/graphql" GRAPHQL_URL = "https://api.medevio.cz/graphql"
REQUEST_ID = "e17536c4-ed22-4242-ada5-d03713e0b7ac" # požadavek který sledujeme REQUEST_ID = "e17536c4-ed22-4242-ada5-d03713e0b7ac" # požadavek který sledujeme
@@ -13,7 +13,7 @@ except:
# === CONFIG === # === CONFIG ===
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
GRAPHQL_URL = "https://api.medevio.cz/graphql" GRAPHQL_URL = "https://api.medevio.cz/graphql"
REQUEST_ID = "e17536c4-ed22-4242-ada5-d03713e0b7ac" # požadavek REQUEST_ID = "e17536c4-ed22-4242-ada5-d03713e0b7ac" # požadavek
@@ -16,7 +16,7 @@ except:
# === KONFIGURACE === # === KONFIGURACE ===
# --- Medevio API --- # --- Medevio API ---
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
GRAPHQL_URL = "https://api.medevio.cz/graphql" GRAPHQL_URL = "https://api.medevio.cz/graphql"
# --- ZPRACOVÁNÍ --- # --- ZPRACOVÁNÍ ---
-1
View File
@@ -1 +0,0 @@
nYvrvgflIKcDiQg8Hhpud+qG8iGZ8eH8su4nyT/Mgcm7XQp65ygY9s39+O01wIpk/7sKd6fBHkiKvsqH
@@ -50,11 +50,7 @@ timestamp = datetime.now().strftime("%Y-%m-%d %H-%M-%S")
xlsx_path = EXPORT_DIR / f"{timestamp} Agenda + Požadavky.xlsx" xlsx_path = EXPORT_DIR / f"{timestamp} Agenda + Požadavky.xlsx"
# ==================== LOAD TOKEN ==================== # ==================== LOAD TOKEN ====================
TOKEN_PATH = Path("token.txt") TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
if not TOKEN_PATH.exists():
TOKEN_PATH = Path(__file__).parent / "token.txt"
if not TOKEN_PATH.exists():
raise SystemExit(f"❌ token.txt not found")
gateway_token = TOKEN_PATH.read_text(encoding="utf-8").strip() gateway_token = TOKEN_PATH.read_text(encoding="utf-8").strip()
headers = { headers = {
+1 -1
View File
@@ -6,7 +6,7 @@ import json
import requests import requests
from pathlib import Path from pathlib import Path
TOKEN_PATH = Path(__file__).parent / "token.txt" TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
GRAPHQL_URL = "https://api.medevio.cz/graphql" GRAPHQL_URL = "https://api.medevio.cz/graphql"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
REQUEST_ID = "6b46b5a8-b080-4821-86b0-39adabeec86b" REQUEST_ID = "6b46b5a8-b080-4821-86b0-39adabeec86b"
+1 -3
View File
@@ -37,9 +37,7 @@ DRY_RUN = False
GRAPHQL_URL = "https://api.medevio.cz/graphql" GRAPHQL_URL = "https://api.medevio.cz/graphql"
CLINIC_SLUG = "mudr-buzalkova" CLINIC_SLUG = "mudr-buzalkova"
TOKEN_PATH = Path(__file__).parent / "token.txt" TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
if not TOKEN_PATH.exists():
raise SystemExit("❌ token.txt not found")
gateway_token = TOKEN_PATH.read_text(encoding="utf-8").strip() gateway_token = TOKEN_PATH.read_text(encoding="utf-8").strip()
headers = { headers = {
-1
View File
@@ -1 +0,0 @@
nYvrvgflIKcDiQg8Hhpud+qG8iGZ8eH8su4nyT/Mgcm7XQp65ygY9s39+O01wIpk/7sKd6fBHkiKvsqH
-1
View File
@@ -1 +0,0 @@
nYvrvgflIKcDiQg8Hhpud+qG8iGZ8eH8su4nyT/Mgcm7XQp65ygY9s39+O01wIpk/7sKd6fBHkiKvsqH