From 073bb3c5fdafd093a8214f696db22635ee9f3c2a Mon Sep 17 00:00:00 2001 From: Ricardo Branco Date: Tue, 29 Aug 2023 17:39:06 +0200 Subject: [PATCH] Fix SSL warnings on valid certificates for openQA servers --- ocw/lib/openqa.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ocw/lib/openqa.py b/ocw/lib/openqa.py index 0c016616..1e295709 100644 --- a/ocw/lib/openqa.py +++ b/ocw/lib/openqa.py @@ -1,3 +1,4 @@ +import os from urllib.parse import urlparse from cachetools import cached import requests @@ -52,7 +53,10 @@ def __new__(cls, **kwargs): def __init__(self, **kwargs): kwargs.pop("server") self.__client = openqa_client.client.OpenQA_Client(server=self.server, **kwargs) - self.__client.session.verify = verify_tls(self.server) + if verify_tls(self.server): + self.__client.session.verify = os.environ.get("REQUESTS_CA_BUNDLE", False) + else + self.__client.session.verify = False def is_cancelled(self, job_id: str) -> bool: if not job_id.isdigit():