We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 84268da commit 87c3fceCopy full SHA for 87c3fce
1 file changed
python/villas/node/node.py
@@ -128,18 +128,18 @@ def load_config(self, i):
128
def request(self, action, method="GET", **args):
129
timeout = args.get("timeout", 1)
130
json_data = args.get("json")
131
-
+
132
url = f"{self.api_url}/api/{self.api_version}/{action}"
133
134
# Prepare the request
135
req = urllib.request.Request(url, method=method)
136
137
# Add JSON data if provided
138
if json_data:
139
req.add_header("Content-Type", "application/json")
140
data = json.dumps(json_data).encode("utf-8")
141
req.data = data
142
143
try:
144
with urllib.request.urlopen(req, timeout=timeout) as response:
145
return json.loads(response.read().decode("utf-8"))
0 commit comments