From 746963157a923c632abcdc2c09eed16796891638 Mon Sep 17 00:00:00 2001 From: "michaela.buzalkova" Date: Tue, 7 Oct 2025 09:06:43 +0200 Subject: [PATCH] sestra --- 02 testík.py | 17 ++++++++--------- 02.2 Testík.py | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/02 testík.py b/02 testík.py index 67c1303..700b29a 100644 --- a/02 testík.py +++ b/02 testík.py @@ -32,7 +32,7 @@ K_DATU = date.today().isoformat() # YYYY-MM-DD ODBORNOSTI = ["001"] # VPL (adult GP) # MySQL -if socket.gethostname().strip() in ("NTBVBHP470G10","Z230"): +if socket.gethostname().strip() == "NTBVBHP470G10": MYSQL_CFG = dict( host="192.168.1.76", port=3307, @@ -175,13 +175,13 @@ ON DUPLICATE KEY UPDATE for p in payloads: pprint(p) - connsql = get_mysql_connection() + conn = pymysql.connect(**MYSQL_CFG) try: - with connsql.cursor() as cur: + with conn.cursor() as cur: cur.executemany(sql, payloads) - connsql.commit() + conn.commit() finally: - connsql.close() + conn.close() print(f"\nUpserted rows: {len(payloads)}") return len(payloads) @@ -216,7 +216,7 @@ def main(): con = get_medicus_connection() cur = con.cursor() - cur.execute("select rodcis, prijmeni, jmeno from kar where rodcis starting with '8'") + cur.execute("select rodcis, prijmeni, jmeno from kar where rodcis starting with '9'") # cur.execute("select first 2 rodcis, prijmeni, jmeno from kar where rodcis starting with '0'") # Vytvor seznam rodnych cisel, která už máme @@ -245,18 +245,17 @@ def main(): "Content-Type": "text/xml; charset=utf-8", "SOAPAction": "process", # Oracle composite usually expects this } - print(envelope) + # Call service resp = session.post(ENDPOINT, data=envelope.encode("utf-8"), headers=headers, timeout=30, verify=VERIFY) print("HTTP:", resp.status_code) # (Optional) Uncomment to see raw XML - print(resp.text) + # print(resp.text) # Parse and save rows, stav = parse_registrace(resp.text) - print(rows,stav) upsert_rows(RC, K_DATU, rows, stav, resp.text) time.sleep(random.uniform(1, 5)) diff --git a/02.2 Testík.py b/02.2 Testík.py index 14538ee..51ed961 100644 --- a/02.2 Testík.py +++ b/02.2 Testík.py @@ -252,7 +252,7 @@ def main(): con = get_medicus_connection() cur = con.cursor() - cur.execute("select rodcis, prijmeni, jmeno from kar where rodcis starting with '6'") + cur.execute("select rodcis, prijmeni, jmeno from kar where rodcis starting with '1'") # cur.execute("select first 2 rodcis, prijmeni, jmeno from kar where rodcis starting with '0'") # Vytvor seznam rodnych cisel, která už máme