Skip to content

Commit

Permalink
advanced_settings: refiners: drone: add custom pem_file support; fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pannal committed Jul 25, 2020
1 parent 52bac14 commit 6484646
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Contents/Libraries/Shared/subliminal_patch/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
from subzero.lib.io import get_viable_encoding

logger = logging.getLogger(__name__)
pem_file = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(unicode(__file__, get_viable_encoding()))), "..", certifi.where()))
pem_file = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(unicode(__file__, get_viable_encoding()))),
"..", certifi.where()))


class TimeoutSession(requests.Session):
Expand All @@ -53,9 +54,9 @@ def request(self, method, url, *args, **kwargs):


class CertifiSession(TimeoutSession):
def __init__(self):
def __init__(self, verify=None):
super(CertifiSession, self).__init__()
self.verify = pem_file
self.verify = verify or pem_file


class NeedsCaptchaException(Exception):
Expand Down
4 changes: 2 additions & 2 deletions Contents/Libraries/Shared/subliminal_patch/refiners/drone.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class DroneAPIClient(object):
_fill_attrs = None

def __init__(self, version=1, session=None, headers=None, timeout=10, base_url=None, api_key=None,
ssl_no_verify=False):
ssl_no_verify=False, pem_file=None):
headers = dict(headers or {}, **{"X-Api-Key": api_key})

#: Session for the requests
self.session = session or CertifiSession()
self.session = session or CertifiSession(verify=pem_file)
if ssl_no_verify:
self.session.verify = False

Expand Down
3 changes: 3 additions & 0 deletions Contents/advanced_settings.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ Don't expect support if you mess this up.
"sonarr": {
// don't verify HTTPS certificates? Set to True for self-signed certificates
"ssl_no_verify": false,
// custom path to certificate pem file
"pem_file": None,
},
"radarr": {
"ssl_no_verify": false,
"pem_file": None,
},
}
}

0 comments on commit 6484646

Please sign in to comment.