sestra
This commit is contained in:
17
02 testík.py
17
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))
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user