Skip to content

Commit a331dd4

Browse files
Adds option to bypass strict HTTPS checks (#243)
* Adds option to bypass strict HTTPS checks * Fix CI pipeline
1 parent faf0e16 commit a331dd4

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
cd inventree_server
4444
invoke install
4545
invoke migrate
46-
invoke import-fixtures
47-
invoke server -a 127.0.0.1:12345 &
46+
invoke dev.import-fixtures
47+
invoke dev.server -a 127.0.0.1:12345 &
4848
invoke wait
4949
- name: Run Tests
5050
run: |

inventree/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def __init__(self, host=None, **kwargs):
4646
token-name - Name of the token to use (default = 'inventree-python-client')
4747
use_token_auth - Use token authentication? (default = True)
4848
verbose - Print extra debug messages (default = False)
49+
strict - Enforce strict HTTPS certificate checking (default = True)
4950
timeout - Set timeout to use (in seconds). Default: 10
5051
proxies - Definition of proxies as a dict (defaults to an empty dict)
5152
@@ -66,6 +67,7 @@ def __init__(self, host=None, **kwargs):
6667
self.token_name = kwargs.get('token_name', os.environ.get('INVENTREE_API_TOKEN_NAME', 'inventree-python-client'))
6768
self.timeout = kwargs.get('timeout', os.environ.get('INVENTREE_API_TIMEOUT', 10))
6869
self.proxies = kwargs.get('proxies', dict())
70+
self.strict = bool(kwargs.get('strict', True))
6971

7072
self.use_token_auth = kwargs.get('use_token_auth', True)
7173
self.verbose = kwargs.get('verbose', False)
@@ -326,6 +328,9 @@ def request(self, api_url, **kwargs):
326328
else:
327329
payload['json'] = data
328330

331+
# Enforce strict HTTPS certificate checking?
332+
payload['verify'] = self.strict
333+
329334
# Debug request information
330335
logger.debug("Sending Request:")
331336
logger.debug(f" - URL: {method} {api_url}")

inventree/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from . import api as inventree_api
88

9-
INVENTREE_PYTHON_VERSION = "0.16.1"
9+
INVENTREE_PYTHON_VERSION = "0.17.0"
1010

1111

1212
logger = logging.getLogger('inventree')

0 commit comments

Comments
 (0)