Skip to content

Commit bbc38a9

Browse files
Fix for https verification
- Pass 'verify=<x>' to all API calls
1 parent ae1f228 commit bbc38a9

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

inventree/api.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,12 @@ def testServer(self):
196196
logger.info("Checking InvenTree server connection...")
197197

198198
try:
199-
response = requests.get(self.api_url, timeout=self.timeout, proxies=self.proxies)
199+
response = requests.get(
200+
self.api_url,
201+
timeout=self.timeout,
202+
proxies=self.proxies,
203+
verify=self.strict
204+
)
200205
except requests.exceptions.ConnectionError as e:
201206
logger.fatal(f"Server connection error: {str(type(e))}")
202207
return False
@@ -583,13 +588,15 @@ def downloadFile(self, url, destination, overwrite=False, params=None, proxies=d
583588
auth = self.auth
584589

585590
with requests.get(
586-
fullurl,
587-
stream=True,
588-
auth=auth,
589-
headers=headers,
590-
params=params,
591-
timeout=self.timeout,
592-
proxies=self.proxies) as response:
591+
fullurl,
592+
stream=True,
593+
auth=auth,
594+
headers=headers,
595+
params=params,
596+
timeout=self.timeout,
597+
proxies=self.proxies,
598+
verify=self.strict,
599+
) as response:
593600

594601
# Error code
595602
if response.status_code >= 300:

0 commit comments

Comments
 (0)