Skip to content

Commit 92b701a

Browse files
committed
do not print SSL verification warnings if IGNORE_SSL_WARNING set in env
1 parent eb689af commit 92b701a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ubiquiti/unifi.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
""" Control a Unifi Controller via Python"""
33
from requests import Session
44
import json
5+
import os
56
import re
67
from typing import Pattern, Dict, Union
78

@@ -37,6 +38,10 @@ def __init__(self, username: str="ubnt", password: str="ubnt", site: str="defaul
3738
self._baseurl = baseurl
3839
self._session = Session()
3940

41+
if not verify_ssl and os.environ.get('IGNORE_SSL_WARNING', False):
42+
import warnings
43+
warnings.filterwarnings("ignore") # Suppress SSL warnings
44+
4045
def __enter__(self):
4146
"""
4247
Contextmanager entry handle.

0 commit comments

Comments
 (0)