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

View File

@@ -8,10 +8,11 @@ Reads Bearer token from token.txt (single line, token only).
import requests
import pandas as pd
import time
from pathlib import Path
from typing import List, Dict, Any
# 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"
CLINIC_SLUG = "mudr-buzalkova" # adjust if needed
LOCALE = "cs"

View File

@@ -6,7 +6,7 @@ from pathlib import Path
import requests # 👈 this is new
# --- 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"
SHOW_FULL_TOKEN = False # set True if you want to print the full token
# -----------------------------------------------------------------

View File

@@ -6,7 +6,7 @@ from pathlib import Path
import requests
# --- 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"
# -----------------------------------------------------------------

View File

@@ -5,7 +5,7 @@ import json
from pathlib import Path
import requests
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
# --- Try including `updatedAt` field directly ---

View File

@@ -5,7 +5,7 @@ import json
from pathlib import Path
import requests
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
GRAPHQL_QUERY = r"""

View File

@@ -11,7 +11,7 @@ from datetime import datetime
# ================================
# 🔧 CONFIGURATION
# ================================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 100
STATES = ["ACTIVE", "DONE"] # optionally add "REMOVED"

View File

@@ -11,7 +11,7 @@ from datetime import datetime
# ================================
# 🔧 CONFIGURATION
# ================================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 1000
STATES = ["ACTIVE", "DONE"] # optionally add "REMOVED"

View File

@@ -3,7 +3,7 @@ import json
from pathlib import Path
# === Nastavení ===
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
REQUEST_ID = "092a0c63-28be-4c6b-ab3b-204e1e2641d4"
OUTPUT_DIR = Path(r"u:\Dropbox\!!!Days\Downloads Z230\Medevio_přílohy")

View File

@@ -2,7 +2,7 @@ import requests
import json
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"
CLINIC_SLUG = "mudr-buzalkova"

View File

@@ -13,7 +13,7 @@ import shutil
# ==============================
# 🔧 CONFIGURATION
# ==============================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
BASE_DIR = Path(r"u:\Dropbox\ordinace\Dokumentace_ke_zpracování\Medevio_přílohy")
BASE_DIR.mkdir(parents=True, exist_ok=True)

View File

@@ -20,7 +20,7 @@ import time
# ==============================
# 🔧 CONFIGURATION
# ==============================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
DB_CONFIG = {

View File

@@ -17,7 +17,7 @@ import time
# ==============================
# 🔧 CONFIGURATION
# ==============================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
GRAPHQL_URL = "https://api.medevio.cz/graphql"
DB_CONFIG = {

View File

@@ -16,7 +16,7 @@ import time
# ==============================
# 🔧 CONFIGURATION
# ==============================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
GRAPHQL_URL = "https://api.medevio.cz/graphql"

View File

@@ -10,7 +10,7 @@ import time, socket
# ===============================
# ⚙️ CONFIG
# ===============================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
DB_CONFIG = {

View File

@@ -10,7 +10,7 @@ import time
# ================================
# ⚙️ CONFIGURATION
# ================================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 100

View File

@@ -18,7 +18,7 @@ import time
# ==============================
# 🔧 CONFIGURATION
# ==============================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
DB_CONFIG = {

View File

@@ -23,7 +23,7 @@ except AttributeError:
# ================================
# 🔧 CONFIGURATION
# ================================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 100

View File

@@ -10,7 +10,7 @@ from dateutil import parser
# ================================
# 🔧 CONFIGURATION
# ================================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
LIMIT = 500 # batch size / number of records

View File

@@ -45,7 +45,7 @@ def safe_print(text: str):
# ==============================
# 🔧 CONFIGURATION
# ==============================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
GRAPHQL_URL = "https://api.medevio.cz/graphql"

View File

@@ -47,7 +47,7 @@ def safe_print(text: str):
# ==============================
# 🔧 CONFIGURATION
# ==============================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
DB_CONFIG = {
"host": "192.168.1.76",

View File

@@ -40,7 +40,7 @@ def safe_print(text: str):
# ==============================
# CONFIG
# ==============================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
DB_CONFIG = {
"host": "192.168.1.76",

View File

@@ -48,7 +48,7 @@ def safe_print(text: str):
# ==============================
# 🔧 CONFIGURATION
# ==============================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
DB_CONFIG = {

View File

@@ -1 +0,0 @@
nYvrvgflIKcDiQg8Hhpud+qG8iGZ8eH8su4nyT/Mgcm7XQp65ygY9s39+O01wIpk/7sKd6fBHkiKvsqH

View File

@@ -20,7 +20,7 @@ import time
# ==============================
# 🔧 CONFIGURATION
# ==============================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
DB_CONFIG = {

View File

@@ -35,7 +35,7 @@ def safe_print(text: str):
# ================================
# 🔧 CONFIG
# ================================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 500

View File

@@ -21,7 +21,7 @@ import argparse
# ==============================
# 🔧 CONFIGURATION
# ==============================
TOKEN_PATH = Path("../10ReadPozadavky/token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
DB_CONFIG = {
"host": "192.168.1.76",

View File

@@ -1 +0,0 @@
nYvrvgflIKcDiQg8Hhpud+qG8iGZ8eH8su4nyT/Mgcm7XQp65ygY9s39+O01wIpk/7sKd6fBHkiKvsqH

View File

@@ -21,7 +21,7 @@ except AttributeError:
# ================================
# 🔧 CONFIGURATION
# ================================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 100

View File

@@ -35,7 +35,7 @@ def safe_print(text: str):
# ================================
# 🔧 CONFIG
# ================================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
BATCH_SIZE = 500

View File

@@ -41,7 +41,7 @@ def safe_print(text: str):
# ==============================
# 🔧 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"
GRAPHQL_URL = "https://api.medevio.cz/graphql"

View File

@@ -19,7 +19,7 @@ except AttributeError:
# ==============================
# CONFIG (.50)
# ==============================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
DB_CONFIG = {
"host": "192.168.1.50",

View File

@@ -40,7 +40,7 @@ def safe_print(text: str):
# ==============================
# 🔧 CONFIGURATION (.50)
# ==============================
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
CLINIC_SLUG = "mudr-buzalkova"
DB_CONFIG = {

View File

@@ -1 +0,0 @@
nYvrvgflIKcDiQg8Hhpud+qG8iGZ8eH8su4nyT/Mgcm7XQp65ygY9s39+O01wIpk/7sKd6fBHkiKvsqH

View File

@@ -13,7 +13,7 @@ except:
# === CONFIG ===
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
GRAPHQL_URL = "https://api.medevio.cz/graphql"
REQUEST_ID = "e17536c4-ed22-4242-ada5-d03713e0b7ac" # požadavek který sledujeme

View File

@@ -13,7 +13,7 @@ except:
# === CONFIG ===
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
GRAPHQL_URL = "https://api.medevio.cz/graphql"
REQUEST_ID = "e17536c4-ed22-4242-ada5-d03713e0b7ac" # požadavek

View File

@@ -16,7 +16,7 @@ except:
# === KONFIGURACE ===
# --- Medevio API ---
TOKEN_PATH = Path("token.txt")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
GRAPHQL_URL = "https://api.medevio.cz/graphql"
# --- ZPRACOVÁNÍ ---

View File

@@ -1 +0,0 @@
nYvrvgflIKcDiQg8Hhpud+qG8iGZ8eH8su4nyT/Mgcm7XQp65ygY9s39+O01wIpk/7sKd6fBHkiKvsqH

View File

@@ -50,11 +50,7 @@ timestamp = datetime.now().strftime("%Y-%m-%d %H-%M-%S")
xlsx_path = EXPORT_DIR / f"{timestamp} Agenda + Požadavky.xlsx"
# ==================== LOAD TOKEN ====================
TOKEN_PATH = Path("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")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
gateway_token = TOKEN_PATH.read_text(encoding="utf-8").strip()
headers = {

View File

@@ -6,7 +6,7 @@ import json
import requests
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"
CLINIC_SLUG = "mudr-buzalkova"
REQUEST_ID = "6b46b5a8-b080-4821-86b0-39adabeec86b"

View File

@@ -37,9 +37,7 @@ DRY_RUN = False
GRAPHQL_URL = "https://api.medevio.cz/graphql"
CLINIC_SLUG = "mudr-buzalkova"
TOKEN_PATH = Path(__file__).parent / "token.txt"
if not TOKEN_PATH.exists():
raise SystemExit("❌ token.txt not found")
TOKEN_PATH = Path(__file__).resolve().parent.parent / "token.txt"
gateway_token = TOKEN_PATH.read_text(encoding="utf-8").strip()
headers = {

View File

@@ -1 +0,0 @@
nYvrvgflIKcDiQg8Hhpud+qG8iGZ8eH8su4nyT/Mgcm7XQp65ygY9s39+O01wIpk/7sKd6fBHkiKvsqH

View File

@@ -1 +0,0 @@
nYvrvgflIKcDiQg8Hhpud+qG8iGZ8eH8su4nyT/Mgcm7XQp65ygY9s39+O01wIpk/7sKd6fBHkiKvsqH