52 lines
1.4 KiB
Python
52 lines
1.4 KiB
Python
from requests import Session
|
|
from requests_pkcs12 import Pkcs12Adapter
|
|
from zeep import Client
|
|
from zeep.transports import Transport
|
|
|
|
# --- Konfigurace ---
|
|
PFX_FILE = "AMBSUKL214235369G_31DEC2024.pfx"
|
|
PFX_PASSWORD = "Vlado7309208104++"
|
|
|
|
WSDL_TEST = "https://lekar-soap.test-erecept.sukl.cz/cuer/Lekar?wsdl"
|
|
WSDL_PROD = "https://lekar-soap.erecept.sukl.cz/cuer/Lekar?wsdl"
|
|
|
|
WSDL_URL = WSDL_PROD # přepni na WSDL_TEST pro testovací prostředí
|
|
|
|
|
|
def get_client():
|
|
sess = Session()
|
|
sess.mount("https://", Pkcs12Adapter(
|
|
pkcs12_filename=PFX_FILE,
|
|
pkcs12_password=PFX_PASSWORD
|
|
))
|
|
transport = Transport(session=sess, timeout=30)
|
|
client = Client(wsdl=WSDL_URL, transport=transport)
|
|
return client
|
|
|
|
|
|
def list_operations(client):
|
|
print("=== Dostupné operace ===")
|
|
for service in client.wsdl.services.values():
|
|
print(f"Service: {service.name}")
|
|
for port in service.ports.values():
|
|
ops = sorted(port.binding._operations.values(), key=lambda o: o.name)
|
|
print(f" Port: {port.name}")
|
|
for op in ops:
|
|
print(f" - {op.name}")
|
|
|
|
|
|
def app_ping(client):
|
|
print("\n=== AppPing ===")
|
|
try:
|
|
resp = client.service.AppPing()
|
|
print(f"Response: {resp}")
|
|
except Exception as e:
|
|
print(f"Chyba: {e}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print(f"Připojuji se na: {WSDL_URL}")
|
|
client = get_client()
|
|
list_operations(client)
|
|
app_ping(client)
|