notebookvb
This commit is contained in:
@@ -5,3 +5,5 @@ __pycache__/
|
|||||||
.idea/
|
.idea/
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
*.pfx
|
*.pfx
|
||||||
|
*.xml
|
||||||
|
*.iml
|
||||||
+28
-7
@@ -1,3 +1,5 @@
|
|||||||
|
import uuid
|
||||||
|
from datetime import datetime, timezone
|
||||||
from requests import Session
|
from requests import Session
|
||||||
from requests_pkcs12 import Pkcs12Adapter
|
from requests_pkcs12 import Pkcs12Adapter
|
||||||
from zeep import Client
|
from zeep import Client
|
||||||
@@ -7,10 +9,18 @@ from zeep.transports import Transport
|
|||||||
PFX_FILE = "AMBSUKL214235369G_31DEC2024.pfx"
|
PFX_FILE = "AMBSUKL214235369G_31DEC2024.pfx"
|
||||||
PFX_PASSWORD = "Vlado7309208104++"
|
PFX_PASSWORD = "Vlado7309208104++"
|
||||||
|
|
||||||
WSDL_TEST = "https://lekar-soap.test-erecept.sukl.cz/cuer/Lekar?wsdl"
|
# HTTP Basic Auth (portál SÚKL)
|
||||||
WSDL_PROD = "https://lekar-soap.erecept.sukl.cz/cuer/Lekar?wsdl"
|
API_USER = "buzalkav"
|
||||||
|
API_PASS = "jgbbeCJTTLstGW7"
|
||||||
|
|
||||||
WSDL_URL = WSDL_PROD # přepni na WSDL_TEST pro testovací prostředí
|
# Lokální WSDL soubory (ze složky Recept)
|
||||||
|
WSDL_LOCAL = r"C:\Users\vlado\Documents\Recept\WSDL_XSD\PRIORITNI_WEBOVE_SLUZBY\CUERLekar.wsdl"
|
||||||
|
|
||||||
|
# Skutečné endpointy
|
||||||
|
ENDPOINT_PROD = "https://lekar-soap.erecept.sukl.cz/cuer/Lekar"
|
||||||
|
ENDPOINT_TEST = "https://lekar-soap.test-erecept.sukl.cz/cuer/Lekar"
|
||||||
|
|
||||||
|
ENDPOINT = ENDPOINT_TEST # testovací prostředí
|
||||||
|
|
||||||
|
|
||||||
def get_client():
|
def get_client():
|
||||||
@@ -19,8 +29,12 @@ def get_client():
|
|||||||
pkcs12_filename=PFX_FILE,
|
pkcs12_filename=PFX_FILE,
|
||||||
pkcs12_password=PFX_PASSWORD
|
pkcs12_password=PFX_PASSWORD
|
||||||
))
|
))
|
||||||
|
sess.auth = (API_USER, API_PASS)
|
||||||
transport = Transport(session=sess, timeout=30)
|
transport = Transport(session=sess, timeout=30)
|
||||||
client = Client(wsdl=WSDL_URL, transport=transport)
|
# Načteme lokální WSDL, endpoint přepíšeme na skutečnou URL
|
||||||
|
client = Client(wsdl=WSDL_LOCAL, transport=transport)
|
||||||
|
# Přepis service endpoint adresy
|
||||||
|
client.service._binding_options["address"] = ENDPOINT
|
||||||
return client
|
return client
|
||||||
|
|
||||||
|
|
||||||
@@ -36,16 +50,23 @@ def list_operations(client):
|
|||||||
|
|
||||||
|
|
||||||
def app_ping(client):
|
def app_ping(client):
|
||||||
print("\n=== AppPing ===")
|
print(f"\n=== AppPing -> {ENDPOINT} ===")
|
||||||
try:
|
try:
|
||||||
resp = client.service.AppPing()
|
zprava = {
|
||||||
|
"ID_Zpravy": str(uuid.uuid4()),
|
||||||
|
"Verze": "201704B",
|
||||||
|
"Odeslano": datetime.now(timezone.utc),
|
||||||
|
"SW_Klienta": "TestRecept12" # přesně 12 znaků
|
||||||
|
}
|
||||||
|
resp = client.service.AppPing(Zprava=zprava)
|
||||||
print(f"Response: {resp}")
|
print(f"Response: {resp}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Chyba: {e}")
|
print(f"Chyba: {e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(f"Připojuji se na: {WSDL_URL}")
|
print(f"Načítám WSDL: {WSDL_LOCAL}")
|
||||||
|
print(f"Endpoint: {ENDPOINT}")
|
||||||
client = get_client()
|
client = get_client()
|
||||||
list_operations(client)
|
list_operations(client)
|
||||||
app_ping(client)
|
app_ping(client)
|
||||||
|
|||||||
Reference in New Issue
Block a user