minor fix

This commit is contained in:
Wilson Gomez 2023-02-03 15:03:12 -05:00
parent ecfd5187e1
commit 2c43a8f9da
1 changed files with 5 additions and 1 deletions

View File

@ -166,7 +166,11 @@ class Model(object):
payload = json.dumps(data, default=encoder)
else:
payload = None
conn = self.conn(self.host, port=self.port, context=self.context_http)
if self.context_http:
conn = self.conn(self.host, port=self.port, context=self.context_http)
else:
conn = self.conn(self.host, port=self.port)
conn.request(method, url, body=payload, headers=HEADERS)
response = conn.getresponse()
res = json.loads(response.read())