import json
import urllib.request

url = "http://localhost:5000/monitoring/service-discovery"
payload = {
"ServerId": 1,
"ContainerId": "aaaaaaaaaaaa",
"Name": "test-Name",
"Image": "test-Image"
}

data = json.dumps(payload).encode("utf-8")
req = urllib.request.Request(
url,
data=data,
headers={"Content-Type": "application/json"},
method="POST"
)

try:
    with urllib.request.urlopen(req) as response:
        resp_data = response.read().decode("utf-8")
        print("Status Code:", response.status)
        print("Response:", resp_data)
except Exception as e:
    print("Fehler beim Senden der Request:", e)

    
