Skip to content
Snippets Groups Projects
Commit 86ae57b4 authored by Antoine Prieels's avatar Antoine Prieels Committed by fw-bot
Browse files

[FIX] iot: DisplayDriver load_url error


We didn't check the status of the response of the server when getting
the url of the display. If the status was different from 200, we tried
to use the error response as URL.

closes odoo/odoo#38554

X-original-commit: 8854f910
Signed-off-by: default avatarQuentin Lejeune (qle) <qle@odoo.com>
parent 72a0fb67
No related branches found
No related tags found
No related merge requests found
......@@ -83,19 +83,21 @@ class DisplayDriver(Driver):
subprocess.Popen(['firefox', self.url], env=firefox_env)
def load_url(self):
url = None
if helpers.get_odoo_server_url():
# disable certifiacte verification
urllib3.disable_warnings()
http = urllib3.PoolManager(cert_reqs='CERT_NONE')
try:
response = http.request('GET', "%s/iot/box/%s/screen_url" % (helpers.get_odoo_server_url(), helpers.get_mac_address()))
urls = json.loads(response.data.decode('utf8'))
return self.update_url(urls[self.device_identifier])
if response.status == 200:
data = json.loads(response.data.decode('utf8'))
url = data[self.device_identifier]
except json.decoder.JSONDecodeError:
return self.update_url(response.get(data.decode('utf8'), False))
url = response.data.decode('utf8')
except Exception:
pass
return self.update_url()
return self.update_url(url)
def call_xdotools(self, keystroke):
os.environ['DISPLAY'] = ":0.0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment