Skip to content

Commit 25fbc1a

Browse files
committed
Add validation & decoding for received json
1 parent 95587b9 commit 25fbc1a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

instana/agent.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,10 @@ def set_host(self, host):
135135
def set_port(self, port):
136136
self.port = port
137137

138-
def set_from(self, from_):
139-
self.from_ = From(**json.loads(from_))
138+
def set_from(self, json_string):
139+
if type(json_string) is bytes:
140+
raw_json = json_string.decode("UTF-8")
141+
else:
142+
raw_json = json_string
143+
144+
self.from_ = From(**json.loads(raw_json))

0 commit comments

Comments
 (0)